akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_E
#define M_E 2.71828182845904523536
#endif

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x)
#endif

#define pln(x) cout << (x) << endl
#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> T& chmin(T &a, const U &b){return a = (a<=b?a:b);}
template <typename T, typename U> T& chmax(T &a, const U &b){return a = (a>=b?a:b);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

int main(){

  int y,m,d;

  scanf("%d/%d/%d", &y, &m, &d);

  if(y < 2019 || (y == 2019 && m < 4) || (y == 2019 && m == 4 && d <= 30)){
    cout << "Heisei" << endl;
  }else{
    cout << "TBD" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int N = 4;

int main() {
  int a = 0, b = 0;
  REP(i, N) { int tmp; cin >>tmp; a += tmp; }
  REP(i, N) { int tmp; cin >>tmp; b += tmp; }
  cout <<max(a, b) <<endl;
  return 0;
}

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

int main(void){
    vector<int> A(6010);
    for(int i=0;i<3010;i++){
        cin>>A.at(2*i)>>A.at(2*i+1);
        
        if(A.at(2*i)==0 && A.at(2*i+1)==0)break;
        else if(A.at(2*i)>=A.at(2*i+1)){
            cout<<A.at(2*i+1)<<" "<<A.at(2*i)<<endl;
        }
        else if(A.at(2*i)<A.at(2*i+1)){
            cout<<A.at(2*i)<<" "<<A.at(2*i+1)<<endl;
        }        
    }
}



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

using namespace std;

const int N = 123456;
int n, m;
int p[N], rev_p[N], x[N], y[N], f[N];

int getp(int x) { return x == f[x] ? x : (f[x] = getp(f[x])); }

int main() {

  cin >> n >> m;
  for (int i = 1; i <= n; ++i) { cin >> p[i]; rev_p[p[i]] = i; }
  for (int i = 1; i <= n; ++i) f[i] = i;
  for (int i = 0; i < m; ++i) {
    cin >> x[i] >> y[i];
    int u = getp(x[i]);
    int v = getp(y[i]);
    f[u] = v;
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (getp(i) == getp(rev_p[i])) ++res;
  }
  cout << res << endl;

  return 0;
}

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

int main(void){
	int N,T,A;
	cin>>N>>T;
	vector<int> a(N);
	int minA=INT_MAX,maxD=0,cnt=0;
	rep(i,N){
		cin>>A;
		if(A<minA){
			minA=A;
		}else if(A-minA>maxD){
			cnt=1;
			maxD=A-minA;
		}else if(A-minA==maxD)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


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

int main(){
  int n,i,s;
  cin >> n;
  vector<int> p(n);
  for(i=0;i<n;i++){
    cin >> p.at(i);
  }
  
  s=0;
  for(i=0;i<n;i++){
    if(p.at(i)==i+1){
      s++;
      i++;
    }
  }
  
  cout << s << endl;
}

Measured memory_bytes: 3704
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Set<String> set = new HashSet<String>();

		for(int i = 0; i < n; i++) {
			set.add(sc.next());
		}

		System.out.println(set.size());
	}

}

Measured memory_bytes: 77896
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;



int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> c(10, vector<int>(10));
    vector<vector<int>> a(h+1, vector<int>(w+1));

    rep(i, 10) rep(j, 10) cin >> c.at(i).at(j);
    rep(i, h) rep(j, w) cin >> a.at(i+1).at(j+1);

    vector<int> dist(10, 0);
    for(int k=0; k<10; k++){
        rep(i, 10) rep(j, 10){
            c.at(i).at(j) = min(c.at(i).at(j), c.at(i).at(k)+c.at(k).at(j));
        }
    }

    ll ans = 0;
    rep(i, h) rep(j, w){
        if(a.at(i+1).at(j+1)==-1) continue;
        
        ans += c.at(a.at(i+1).at(j+1)).at(1);
    }

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


Measured memory_bytes: 384
N,W  = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
MAX_VAL = 100100
MAX_WEIGHT = 10**10

dp = [[MAX_WEIGHT for _ in range(MAX_VAL+1)] for _ in range(N+1)]

dp[0][0] = 0
for i in range(N):
    value = wv[i][1]
    for v in range(MAX_VAL+1):
        dp[i+1][v] = dp[i][v]
        if v >= value:
            dp[i+1][v] = min(dp[i+1][v], dp[i][v-value]+wv[i][0])
max_v = 0
for i in range(MAX_VAL+1):
    if dp[N][i] <= W:
        max_v = i
print(max_v)

Measured memory_bytes: 171120
import sys

class UFT(): #Union-find tree class
    def __init__(self, N): 
        self.tree = [int(i) for i in range(N)] 
        self.rank = [0 for i in range(N)]

    def find(self, a):
        if self.tree[a] == a: return a
        else:
            self.tree[a] = self.find(self.tree[a])
            return self.tree[a]

    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b: return
        if self.rank[a] < self.rank[b]: self.tree[a] = b
        else:
            self.tree[b] = a
            if self.rank[a] == self.rank[b]: self.rank[a] += 1

def solve():
    input = sys.stdin.readline
    N, M, K = map(int, input().split())
    parent = UFT(N)
    NG = [0] * N
    Connected = [0] * N
    treeSize = dict()
    for _ in range(M):
        x, y = map(int, input().split())
        parent.unite(x-1, y-1)
        Connected[x-1] += 1
        Connected[y-1] += 1
    for _ in range(K):
        x, y = map(int, input().split())
        if parent.find(x-1) != parent.find(y-1): continue
        parent.unite(x-1, y-1)
        NG[x-1] += 1
        NG[y-1] += 1
    for i in range(N):
        key = parent.find(i)
        if key in treeSize: treeSize[key] += 1
        else: treeSize[key] = 1
    Ans = [0] * N
    for i in range(N):
        Ans[i] = treeSize[parent.find(i)] - Connected[i] - NG[i] - 1
    print(" ".join(map(str, Ans)))

    return 0

if __name__ =="__main__":
    solve()

Measured memory_bytes: 25892
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<limits>
//include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	cin >> N;
	map<string, int>frequency;
	int max = 0;
	string tmp;
	vector<string>most_vote;
	for (int i = 0; i < N; i++)
	{
		cin >> tmp;
		if (frequency.find(tmp) != frequency.end())
		{
			frequency[tmp]++;
		}
		else
			frequency[tmp] = 1;
		if (frequency[tmp] > max)
			max = frequency[tmp];
	}
	map<string, int>::iterator it;

	for (it = frequency.begin(); it != frequency.end(); it++)
	{
		if (it->second == max)
			most_vote.push_back(it->first);
	}
	sort(most_vote.begin(), most_vote.end());
	for (int i = 0; i < most_vote.size(); i++)
		cout << most_vote[i] << endl;
}

Measured memory_bytes: 26992
#include<stdio.h>
#include<stdlib.h>
#define ll long long
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
int r[4002] = {0};
int g[4002] = {0};
int b[4002] = {0};
int  main(){
    int n;
    scanf("%d",&n);
    char s[n + 1];
    scanf("%s",s);
    ll ans = 0, count = 0;
    for(int i = 1; i <= n; i++){
        if(s[i - 1] == 'R')
            r[i] = 1;
        if(s[i - 1] == 'G')
            g[i] = 1;
        if(s[i - 1] == 'B'){
            b[i] = 1;
            count ++;
        }
    }
    for(int i = 1; i <= n ; i++){
        for(int j = 1; j <= n ; j++){
            if(r[i] == 1 && g[j] == 1){
                ans += count;
                int p = abs(i - j);
                int m = max(i, j);
                int q = min(i, j);
                if(m + p <= n && b[m + p] == 1) ans --;
                if(q > p && b[q - p] == 1) ans --;
                if(p % 2 == 0 && b[p / 2 + q] == 1) ans --;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REPE(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
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<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    int n; cin >> n;
    int sum = 0;
    rep(i, 26){
        rep(j, 29){
            sum = i * 4 + j * 7;
            if(sum == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   int k;
   cin>>k;
  cout<<a[k-1]<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>	
#include<cstring>
#include<iomanip>
#include <string>
#include <vector>	
#include<unordered_map>
#include<unordered_set>
using namespace std;


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const int mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn

int main()
{
	IO;
	int n{},d{},x{},ans{};
	cin>>n>>d>>x;
	vector<int>v(n);
	ans=n;
	For(i,0,n)cin>>v[i];
	For(i,1,d+1)
	{
		For(j,0,n)
			if((i*v[j])+1<=d)ans++;
	}
	cout<<ans+x<<'\n';
	//system("pause");
	return 0;

}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <fstream>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

#define ll long long
#define MOD 1000000007
ll myabs(ll x)
{
	return (x > 0 ? x : -x);
}



ll Modpow(int x)
{
	ll ans = 1;
	if (x == 0)return ans;
	if (x == 1)return 2;
	ans = Modpow(x / 2);
	ans *= ans;
	if (x % 2 == 1)
	{
		ans *= 2;
	}
	ans %= MOD;
	return ans;
}
int main()
{
	int n = 0;
	cin >> n;
	vector<ll> a(n);
	map<int, int> cnt;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		cnt[a[i]]++;
	}
	bool incons = 0;
	if (n % 2 == 1)
	{
		for (int i = 0; i <= n / 2; i++)
		{
			if ((i == 0 && cnt[2*i] != 1) || (i!=0 && cnt[2*i] != 2))
			{
				incons = true;
				break;
			}
		}
	}
	else
	{
		for (int i = 1; i <= n / 2; i++)
		{
			if (cnt[2 * i - 1] != 2)
			{
				incons = true;
				break;
			}
		}
	}
	if (incons)cout << "0\n";
	else
	{
		cout << Modpow(n / 2) << endl;
	}
	
}


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

int main(){
    int n; cin>>n;
    int acc = 0;
    int temp;
    for (int i=0;i<n;i++){
        cin >> temp;
        if (temp != i+1){
            acc++;
        }
    }
    if (acc <= 2){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
e = [0] * (N+1)
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m): # e の要素のうち m-1 以上のものの個数
    return len(list(filter(lambda x: x >= m-1, e)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)

Measured memory_bytes: 3188
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [0]*n
    for i,j in enumerate(h):
        if i > 0:
            p = max(i-k,0)
            dp[i] = min(k+abs(l-j) for k,l in zip(dp[p:i],h[p:i]))

    print(dp[n-1])

if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 23832
#include <stdio.h>
int main(void) {
	int r,D,x,i;
	int y[11] = {};
	
	scanf("%d %d %d",&r,&D,&x);
	
	y[0] = x;
	for (i=1 ; i<11 ; i++) {
		y[i] = r*y[i-1]-D;
		printf("%d\n",y[i]);
	}
	return 0;
}

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

int main() {
	int n, m; cin >> n >> m;
	int a[110][110];
	int b[110];

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) cin >> a[i][j];
	}
	for (int i = 0; i < m; ++i) cin >> b[i];

	for (int i = 0; i < n; ++i) {
		int sum = 0;
		for (int j = 0; j < m; ++j) {
			sum += a[i][j] * b[j];
		}
		cout << sum << endl;
	}
}


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

using namespace std;

int GCD(int a, int b){
 	return (min(a, b) == 0 ? max(a, b) : GCD(max(a, b)%min(a,b), min(a, b)));
}

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

    int A_gcd;
    for(int i = 1; i <= N; i++) {
        int H;
        cin >> H;
        A_gcd = (i == 1 ? H : GCD(A_gcd, H));
    }

    cout << A_gcd;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int n, m;
	int i,j;
	m = 0;
	scanf("%d", &n);
		scanf("%d", &m);
		n = n % 500;
		if (n <= m) {

			printf("Yes");
		}
		else {
			printf("No");
		}
	return 0;
}


Measured memory_bytes: 128
// #include "stones.h"
#include <iostream>
#include <string>
#include <vector>

std::string game(const std::vector<int>& numbers, int pile_size)
{
    std::vector<short> dp(pile_size + 1);

    for (int i = 0; i <= pile_size; ++i) {
        for (auto x : numbers)
            if (i >= x && !dp[i - x])
                dp[i] = true;
    }

    return dp.back() ? "First" : "Second";
}

int main(int argc, char* argv[])
{
    size_t num_numbers;
    int pile_size;
    std::cin >> num_numbers >> pile_size;
    std::vector<int> numbers(num_numbers);
    for (size_t i = 0; i < num_numbers; ++i) {
        int number;
        std::cin >> number;
        numbers[i] = number;
    }
    std::cout << game(numbers, pile_size) << std::endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
const int MAX = 1000000000;
const int MAXN=20000+10;
typedef long long LL;
char s[MAXN];
int a[MAXN], b[MAXN];
int n;
int main(){
    //freopen("t.in", "r", stdin);
    scanf("%d", &n);
    int t = (MAX-10)/n;
    a[1]=1;
    for(int i=2; i<=n; ++i){
        a[i] = a[i-1] + t;
    }
    for(int i=1; i<=n; ++i){
        b[i] = a[n-i+1];
    }
    for(int i=1, x; i<=n; ++i){
        scanf("%d", &x);
        a[x]+=i;
    }
    for(int i=1; i<=n; ++i) printf("%d ", a[i]);
    printf("\n");
    for(int i=1; i<=n; ++i) printf("%d ", b[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 768
n, a, b, c, d = map(int, input().split())
a, b, c, d = a-1, b-1, c-1, d-1
s = input()

if "##" in s[a:d]:
    print("No")
    exit()

if c < d:
    for i in range(b, d):
        if s[i:i+2] == "##":
            print("No")
            exit()

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "#" and s[i-1] == "." and s[i+1] == ".":
            print("Yes")
            exit()

    print("No")

Measured memory_bytes: 3572
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int N, A[100][100];

int main(int argc, char* argv[]) {
  cin >> N;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < N; j++)
      cin >> A[i][j];

  int score = A[0][0];
  for (int i = 0; i < N; i++)
    score += A[1][i];
  int res = score;

  for (int i = 1; i < N; i++) {
    score += A[0][i] - A[1][i - 1];
    if (res < score)
      res = score;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long LL;
 
const int MAX_N=1005;
int n,m;
LL a[MAX_N];
vector<LL> v1,v2;
 
void Build();
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<n;++i)
		cin>>a[i];
	for(int i=0;i<n;++i)
	{
		LL ss=0;
		for(int j=i;j<n;++j)
		{
			ss+=a[j];
			v1.push_back(ss);
		}
	}
	LL ans=0;
	for(int i=40;i>=0;--i)
	{
		v2.clear();
		LL p=((LL)1<<i);
		for(auto c:v1)
			if(c&p)	v2.push_back(c);
		if(v2.size()>=m){
			ans+=p;
			v1.clear();	v1=v2;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int t,s,d;
  cin >> d >> t >> s;
  cout << (t*s>=d ? "Yes" : "No") << endl;
}



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

int N;
int cnt[10][10];

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    for (int i=1; i<=N; i++) {
        string j = to_string(i);
        int f = j[0]-'0';
        int l = j[j.size()-1]-'0';
        cnt[f][l]++;
    }
    int ans = 0;
    rep(i, 10) rep(j, 10) ans += cnt[i][j]*cnt[j][i];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int n,s,t;
int tot,rd[200005],sz[200005],bg[200005],ed[200005],use[200005];
int h[200005],fr[1000005],to[1000005],f[1000005],cnt=1;
void add(int x,int y,int z)
{
	fr[++cnt]=h[x];
	h[x]=cnt;
	to[cnt]=y;
	f[cnt]=z;
}
int dis[200005];
bool bfs()
{
	memset(dis,-1,sizeof(dis));
	queue<int>q;
	q.push(s);
	dis[s]=0;
	while(!q.empty())
	{
		int now=q.front();
		q.pop();
		for(int i=h[now];i;i=fr[i])
		{
			if(f[i]&&dis[to[i]]==-1)
			{
				dis[to[i]]=dis[now]+1;
				if(to[i]==t)return 1;
				q.push(to[i]);
			}
		}
	}
	return 0;
}
int dfs(int now)
{
	if(now==t)return 1;
	for(int i=use[now];i;i=fr[i])
	{
		use[now]=i;
		if(dis[to[i]]==dis[now]+1&&f[i])
		{
			int r=dfs(to[i]);
			if(!r)dis[to[i]]=-1;
			if(r)
			{
				//cout<<now<<' '<<to[i]<<endl;
				f[i]=0;
				f[i^1]=1;
				return 1;
			}
		}
	}
	return 0;
}
int dinic()
{
	int ans=0;
	while(bfs())
	{
		for(int i=0;i<=t;i++)use[i]=h[i];
		while(dfs(s))
		{
			ans++;
		}
	}
	return ans;
}
int bel[100005],rt,g[100005][2],fa[100005];
void dfs1(int now)
{
	cnt++;
	for(int i=h[now];i;i=fr[i])
	{
		if(!fa[to[i]])
		{
			fa[to[i]]=now;
			g[bel[to[i]]][0]=now;g[bel[to[i]]][1]=to[i];
			dfs1(to[i]);
		}
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		scanf("%d",&sz[i]);
		bg[i]=tot+1;
		for(int j=1;j<=sz[i];j++)
		{
			scanf("%d",&rd[tot+1]);
			tot++;
		}
		ed[i]=tot;
	}
	for(int i=1;i<=n;i++)
	{
		add(s,i,1);
		add(i,s,0);
	}
	t=2*n;
	for(int i=1;i<n;i++)
	{
		add(i+n,t,1);
		add(t,i+n,0);
		for(int j=bg[i];j<=ed[i];j++)
		{
			add(rd[j],i+n,1);
			add(i+n,rd[j],0);
		}
	}
	int flow=dinic();
	//cout<<flow<<endl;
	if(flow!=n-1)
	{
		printf("-1\n");
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=h[i];j;j=fr[j])
		{
			//cout<<i<<' '<<to[j]<<endl;
			if(to[j]!=s&&f[j]==0)
			{
				bel[i]=to[j]-n;
				break;
			}
		}
		if(!bel[i])rt=i;
		//cout<<i<<' '<<bel[i]<<endl;
	}
	memset(h,0,sizeof(h));
	cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(i!=rt)
		{
			for(int j=bg[bel[i]];j<=ed[bel[i]];j++)
			{
				if(rd[j]!=i)add(rd[j],i,0);
			}
		}
	}
	cnt=0;
	dfs1(rt);
	//cout<<cnt<<endl;
	if(cnt!=n)printf("-1");
	else
	{
		for(int i=1;i<n;i++)
		{
			printf("%d %d\n",g[i][0],g[i][1]);
		}
	}
}

Measured memory_bytes: 22772
#include<bits/stdc++.h>
using namespace std;
string s;
long long dfs(int index,long long out,long long val)
{
	if(index==s.size())
		return (out*(val==0));
	return (dfs(index+1,out,val*10+(s[index]-'0'))+dfs(index+1,out+val*10+(s[index]-'0'),0));
}
int main()
{
	cin>>s;
	cout<<dfs(0,0,0)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}
int main(){
    ll A,B;
    cin>>A>>B;
    YN(A % 2 == 1 && B%2 == 1);
    return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "cmath"
#include "vector"
using namespace std;

vector <int> h;
vector <long long> cost;

long long solve(int x) {
    if (cost[x] != -1) {
        return cost[x];
    }

    if (x == 1) {
        cost[x] = 0;
    }
    else if (x == 2) {
        cost[x] = solve(x - 1) + abs(h[x] - h[x-1]);
    }
    else {
        long long jump_1 = solve(x-1) + abs(h[x] - h[x - 1]);
        long long jump_2 = solve(x-2) + abs(h[x] - h[x - 2]);
        cost[x] = min(jump_1, jump_2);
    }

    return cost[x];
}

int main() {
    int n;
    cin >> n;
    h.resize(n + 1);
    cost.resize(n + 1, -1LL);
    for (int i=1; i<=n; i++) cin >> h[i];
    solve(n);
    cout << cost[n] << '\n';
}


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

using namespace std ;

pair<pair<string,int >,int> p[110] ;

int  main () {

    int n,i,pi ;
    string s ;

    cin >> n ;



    for (i=1;i<=n;i++){
        cin >> s >> pi ;
        p[i-1]=make_pair(make_pair(s,-pi),i);

    }
    sort(p,p+n) ;

    for (i=0;i<n;i++){
        cout << p[i].second << endl  ;
    }

    return 0 ;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mirrored
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal ans = 0;
            decimal D = decimal.Parse(Console.ReadLine());
            if (D % 9 != 0)
            {
                Console.WriteLine(0);
                Console.ReadLine();
                return;
            }
            int ketaD = D.ToString().Length;
            D /= 9;

            for (int i = ketaD; i <= 2 * ketaD; i++)
            {
                ans += chkNumber(i, D);
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static decimal chkNumber(int keta, decimal target)
        {
            decimal ans = 0;
            bool ret = false;
            List<decimal> insu = new List<decimal>();
            int n = keta / 2;
            bool arbitrary = keta % 2 == 0 ? false : true;

            for (int i = 0; i < n; i++)
            {
                insu.Add(((decimal)Math.Pow(10, keta - (i + 1)) - (decimal)Math.Pow(10, i)) / 9);
            }

            List<decimal> corr = new List<decimal>();

            for (int i = 0; i < insu.Count; i++)
            {
                corr.Add(target / (decimal)Math.Pow(10, i) % 10);
                target = target - corr[i] * insu[i];
                if (target == 0)
                {
                    ret = true;
                    //break;
                }
            }

            if (ret)
            {
                for (int i = 0; i < corr.Count; i++)
                {
                    if (i == 0) ans = 9 - corr[i];
                    else
                    {
                        ans *= 10 - (decimal)Math.Abs(corr[i]);
                    }
                }
                if (arbitrary) ans *= 10;
            }
            else ans = 0;
            return ans;
        }
    }
}


Measured memory_bytes: 13524
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[][] = new int[2][N];
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < N; j++) {
				A[i][j] = sc.nextInt();
			}
		}
		int max = 0;
		for (int i = 0; i < N; i++) {
			int cnt = 0;
			for (int j = 0; j <= i; j++) {
				cnt += A[0][j];
			}
			cnt += A[1][i];
			for (int j = i+1; j < N; j++) {
				cnt += A[1][j];
			}
			if (cnt > max) {
				max = cnt;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<pii> D(n);
	for (int i = 0; i < n; i++) {
		cin >> D[i].first >> D[i].second;
	}
	
	for (int i = 0; i < n - 2; i++) {
		bool good = true;
		for (int x = 0; x < 3; x++) {
			good &= D[i + x].first == D[i + x].second;
		}
		if (good) {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
using namespace std;
char maps[1001][1001];
int n;
bool rectn(int y,int x,int k){
	for(int i=0;i<k;i++){
		if(i+y>=n||i+x>=n||maps[y+k-1][i+x]=='*'||maps[i+y][x+k-1]=='*')return false;
	}
	return true;
}
int rect(int y,int x){
	for(int k=1;1;k++){
		if(k-1>=n||!rectn(y,x,k))return k-1;
	}
}
void solve(){
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(maps[i][j]=='.'){
				ans=max(ans,rect(i,j));
			}
		}
	}
	cout<<ans<<endl;
}

int main(){
	while(cin>>n&&n){
		for(int i=0;i<n;i++){
			cin>>maps[i];
		}
		solve();
	}
	return 0;
}

Measured memory_bytes: 1636
#include <iostream>                                                                                                       

int gcd(int a, int b){ 
   if(a<b) return gcd(b, a); 
   int r;
   while((r=a%b)){
      a = b;
      b = r;
   }   
   return b;
}

int main(){
   int N;
   std::cin >> N;
   int A[N];
   for(int i=0; i<N; ++i)
      std::cin >> A[i];

   int l = A[0];
   int r = A[N-1];
   int left[N], right[N];
   for(int i=0; i<N; ++i){
      l = gcd(l,A[i]);
      left[i] = l;
      r = gcd(r,A[N-1-i]);
      right[i] = r;
   }   
   int ans = 0;
   for(int i=0; i<N; ++i){
      int a = (i>0 ? left[i-1] : right[N-1-i-1]);
      int b = (i<N-1 ? right[N-1-i-1] : left[i-1]);
      int rest = gcd(a, b); 
      if(rest>ans) ans = rest;
   }   

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

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

int main(){
    long long n;
    long long diff;
    long long count=0;
    long long temp=0;
    cin >> n;
    vector<long long> a(n);

    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }

    for(int i=0;i<n;i++){
        if(temp>a.at(i)){
            diff=temp-a.at(i);
            count+=diff;
            temp=a.at(i)+diff;
        }else{
            temp=a.at(i);
        }
    }

    cout << count << endl;

    return(0);
}


Measured memory_bytes: 4708
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int h,n,i,sum=0;
    cin>>h>>n;
    int s[n];
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        sum=sum+s[i];
    }
    if(h-sum<=0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}




Measured memory_bytes: 640
#include<iostream>
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	for(int i=a;i<=100000;i+=a)
	{
		if(i%b==c)
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {

			var inputArray = retreiveLongArray();
			var inputCount = 5;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var X = (int)inputArray[0];
			var Y = (int)inputArray[1];
			var A = (int)inputArray[2];
			var B = (int)inputArray[3];
			var C = (int)inputArray[4];

			var P = retreiveLongArray().OrderByDescending(x=>x).ToArray();
			var Q = retreiveLongArray().OrderByDescending(x => x).ToArray();
			var R = retreiveLongArray().OrderByDescending(x => x).ToArray();

			var Red = P.Take(X).ToList();
			var Green = Q.Take(Y).ToList();

			Red.AddRange(Green);
			var all = Red.OrderBy(x => x).ToArray();

			var a = 0;
			var c = 0;

			while (all[a] < R[c]) {
				all[a] = R[c];
				a++;
				c++;
				if (a==(X+Y)) {
					break;
				}
				if (c == C) {
					break;
				}
			}

			//答えの出力
			var ans = all.Sum();
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 66632
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,m,x,a[20][20],ans=1000000000,che[20];bool f[20];
bool check(){
	memset(che,0,sizeof che);
	for(int i=1;i<=20;i++){
		if(f[i]==1)
		for(int j=1;j<=m;j++)
		che[j]+=a[i][j];
	}
	for(int i=1;i<=m;i++)
	if(che[i]<x)return 0;
	return 1;
}
void ss(){
	int sum=0;
	for(int i=1;i<=20;i++)
	if(f[i]==1)sum+=a[i][0];
	ans=min(ans,sum);
}
void dfs(int i){
	if(i==n+1){
		if(check())ss();
		return ;
	}
	f[i]=1;dfs(i+1);f[i]=0;dfs(i+1);
}
int main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	in(n);in(m);in(x);
	for(int i=1;i<=n;i++){
		in(a[i][0]);
		for(int j=1;j<=m;j++)
		in(a[i][j]);
	}
	dfs(1);
	if(ans==1000000000)printf("-1\n");else printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3768
#include <stdio.h>

int main(void){
    //input 
    int N;
    scanf("%d",&N);

    //calcu
    double a,ans,n;
    if(N % 2 == 0){
        ans = 0.50000;
        //printf("aaa");
    }else{
        n = N;
        int A = N/2+1 ;
        a = A;
        ans = a / n;
        //printf("%d",A/1);
    }


    //output
    printf("%f",ans);
}

Measured memory_bytes: 128
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
s = int(input())
print(k[s-1])

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public string S;
        public int N;
        public long MOD = 1000000007;

        public void Run()
        {
            S = Console.ReadLine();
            N = S.Length;

            int count = Math.Max(CheckCenter('0'), CheckCenter('1'));
            Console.WriteLine((N + count) / 2);
        }


        public int CheckCenter(char c)
        {
            int count = 0;
            if (N % 2 == 0)
            {
                int l = N / 2 - 1;
                int r = N / 2;
                while (true)
                {
                    if (S[l] == c && S[r] == c)
                    {
                        count += 2;
                        l--;
                        r++;
                    }
                    else
                    {
                        return count;
                    }

                    if (l < 0) return count;
                }
            }
            else
            {
                int l = N / 2;
                int r = N / 2;
                while (true)
                {
                    if (S[l] == c && S[r] == c)
                    {
                        count += (l == r ? 1 : 2);
                        l--;
                        r++;
                       
                    }
                    else
                    {
                        return count;
                    }
                    if (l < 0) return count;
                }
            }

        }

    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 11232
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main(){
    int N, M;
    cin >> N;
    vector<string> s(N);
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }
    cin >> M;
    vector<string> t(M);
    for(int i = 0; i < M; i++){
        cin >> t[i];
    }

    map<string, int> mp;

    for(int i = 0; i < N; i++){
        mp[s[i]]++;
    }
    for(int i = 0; i < M; i++){
        mp[t[i]]--;
    }

    int max = 0;
    for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++){
        if(max < it->second) max = it->second;
    }

    cout << max << endl;
}

Measured memory_bytes: 256
#include <iostream>
int main()
{
	using namespace std;
	int H, N;
	int moves[100001];
	cin >> H >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> moves[i];
	}
	int sum = 0, test = 0;
	for (int i = 0; i < N; i++)
	{
		sum = sum + moves[i];
		if (sum >= H)
		{
			cout << "Yes";
			test = 1;
			break;
		}

	}
	if (test == 0)
	{
		cout << "No";
	}


	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    long N,cnt=0,keep=0;
    string S,T;
    cin >> S>>T;
    if(T.size()==S.size()+1){
        for(int i=0;i<S.size();i++){
            if(S[i]!=T[i]){
                cout << "No";
                break;
            }else if(i==S.size()-1){
                cout <<"Yes";
            }
        }
    }else{
        cout << "No";
    }
}

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

const int INF = 1e9;

long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int main() {
  int n;
  cin>>n;
  long long t[n];
  for (int i=0; i<n; i++) cin>>t[i];

  sort(t, t+n);
  reverse(t, t+n);
  long long ans = t[0];
  vector<long long> a;
  for (int i=1; i<n; i++) {
    if (ans % t[i] != 0) {
      a.push_back(t[i]);
    }
  }
  for (int i=0; i<a.size(); i++) {
    if (ans % a[i] == 0) {
      continue;
    }
    long long tmp = gcd(ans, a[i]);
    ans = ans / tmp * a[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n,l=map(int,input().split())
ans=0
for i in range(l,l+n):
    ans+=i
l2=l+n-1
    
if l2 < 0:
    print(ans-l2)
elif l < 0 and l2 >=0:
    print(ans)
elif l >= 0:
    print(ans-l)
    




Measured memory_bytes: 2940
package main

import (
	"fmt"
)

func minInt(a, b int) int {
	switch {
	case a < b:
		return a
	default:
		return b
	}
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	xArray := make([]int, n)
	for i := range xArray {
		fmt.Scan(&xArray[i])
	}

	cost := 0
	for i := 1; i < n; i++ {
		cost += minInt((xArray[i]-xArray[i-1])*a, b)
	}
	fmt.Println(cost)
}


Measured memory_bytes: 5504
N=int(input())
dp=[[0]*3 for i in range(N+1)]
for i in range(N):
  a=list(map(int,input().split()))
  for j in range(3):
    for k in range(3):
      if j==k:
        continue
      dp[i][k]=max(dp[i][k],dp[i-1][j]+a[k])
print(max(dp[N-1]))

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


int knapsack(int m,vector<int> &weight,vector<int> &value,int n){

	int dp[n+1][m+1];

	for (int i = 0; i <=n; ++i)
	{
		for (int j = 0; j <=m ; ++j)
		{
			if(i==0 || j==0 ) dp[i][j]=0;
			else if(weight[i] > j) dp[i][j]=dp[i-1][j];
			else dp[i][j]=max(value[i] + dp[i-1][j-weight[i]],dp[i-1][j]);
		}
	}
	return dp[n][m];

}

int32_t main(){


	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


	int n,m;
	cin>>n>>m;

	vector<int> weight(n+1);
	vector<int> value(n+1);
	for (int i = 1; i <= n; ++i)
	{
		cin>>weight[i];cin>>value[i];
	}

	cout<<knapsack(m,weight,value,n)<<endl;
}

Measured memory_bytes: 79232
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

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

    vector<int> V(N);
    for (int i = 0; i < N; i++)
        cin >> V[i];

    vector<int> C(N);
    for (int i = 0; i < N; i++)
        cin >> C[i];

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int d = V[i] - C[i];
        if (d > 0)
            ans += d;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	int n;
	string s;
	cin >> n >> s;
	for (char& c : s) {
		c = char((int(c - 'A') + n) % 26 + 'A');
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
N,M = list(map(int,input().split()))
lst = [set() for i in range(N+1)]
for i in range(M):
    a,b = list(map(int,input().split()))
    lst[a].add(b)

for intermediate in lst[1]:
    if N in lst[intermediate]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 60824
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N){
  vector<vector<long long>> c(10, vector<long long>(10, 0));
  int a, b, n;
  long long ret = 0;
  for (int i = 1; i < N+1; ++i) {
    n = i;
    a = i % 10;
    if (a == 0) continue;
    b = i % 10;
    for (int j = 0; j < 6; ++j) {
      n /= 10;
      if (n%10 != 0) {
        b = n%10;
      }
    }
    c[a-1][b-1] += 1;
  }
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      ret += c[i][j] * c[j][i];
    }
  }
  std::cout << ret << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string HEX = "0123456789ABCDEF";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),std::greater<int>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

int main(void) {
    string s,t;
    cin >> s >> t;
    vector<char> sv, tv;
    REP(i,s.length()){
        sv.push_back(s[i]);
    }
    REP(i,t.length()){
        tv.push_back(t[i]);
    }
    SORT(sv);
    SORTR(tv);
    s = t = "";
    REP(i,sv.size()){
        s += sv[i];
    }
    REP(i,tv.size()){
        t += tv[i];
    }
    Yn(s<t);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N; cin >> N;
  ll a = -1, b = 1000000000;
  for(int i = 0; i < N; i++) {
    ll x; cin >> x;
    a = max(a, x);
    b = min(b, x);
  }
  cout << (a - b) << endl;
}


Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
ans='Yay!'
A=[a,b,c,d,e]
for i in A:
    for j in A:
        if abs(i-j)>k:
            ans=':('
print(ans)

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  constexpr int lim = 1e4;
  vector<int> res(lim + 1);
  for (int x = 1; x <= 100; ++x) {
    for (int y = 1; y <= 100; ++y) {
      for (int z = 1; z <= 100; ++z) {
        int cur = x * x + y * y + z * z + x * y + y * z + z * x;
        if (cur <= lim) {
          ++res[cur];
        }
      }
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cout << res[i] << '\n';
  }
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
int x[100];
int y[100];
int h[100];

int main(){
    int n;cin>>n;
    int cx_a,cy_a,h_a;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
    }
    for(int cx=0;cx<101;cx++){
        for(int cy=0;cy<101;cy++){
            int H;
            for(int i=0;i<n;i++){
                if(h[i]==0) continue;
                H=h[i]+abs(x[i]-cx)+abs(y[i]-cy);
                break;
            }
            for(int i=0;i<n;i++){
                if(h[i]!=max(H-abs(x[i]-cx)-abs(y[i]-cy),0)) break;
                if(i==n-1){
                    cx_a=cx;
                    cy_a=cy;
                    h_a=H;
                }
            }
        }
    }
    cout<<cx_a<<' '<<cy_a<<' '<<h_a<<endl;
}

Measured memory_bytes: 256
from bisect import bisect_right, bisect_left

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()

ans = 0
for b in B:
    a = bisect_left(A, b)
    c = N - bisect_right(C, b)
    ans += a * c

print(ans)


Measured memory_bytes: 23232