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

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){    

    char c;
    cin>>c;

    if(isupper(c)) cout<<"A";
    else cout<<"a";
    
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    if(x==0) 
    {
        if(k%2) cout<<d-x;
        else cout<<0;
    }
    else if(x/d>=k){
        x=x-(k*d);
        cout<<abs(x);
       
    }
    else
    {
        l=x/d;
        x-=(l*d);
        k-=(l);
        if(k%2) cout<<d-x;
        else cout<<x;
    }
    
    return 0;
}

Measured memory_bytes: 3524
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        a = a==1 ? 14 : a;
        int b = sc.nextInt();
        b = b==1 ? 14 : b;
        if(a==b)
        System.out.println("Draw");
        else if(a>b)
        System.out.println("Alice");
        else
        System.out.println("Bob");
    }
}

Measured memory_bytes: 21204
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,x = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	b = zeros(Int,n)
	b[1]=min(a[1],x)
	for i in 2:n
		b[i]=min(a[i],x-b[i-1])
	end
	println(sum(a)-sum(b))
end

main()

Measured memory_bytes: 119928
using System;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int W = cin.ni();
        int H = cin.ni();
        int N = cin.ni();

        int right = W;
        int left = 0;
        int top = H;
        int bottom = 0;

        for (int i = 0; i < N; i++) {
            int x = cin.ni();
            int y = cin.ni();
            int a = cin.ni();

            switch (a) {
                case 1:
                    left = Math.Max(left, x);
                    break;
                case 2:
                    right = Math.Min(right, x);
                    break;
                case 3:
                    bottom = Math.Max(bottom, y);
                    break;
                case 4:
                    top = Math.Min(top, y);
                    break;
                default:
                    break;
            }
        }

        right = Math.Max(right, left);
        top = Math.Max(top, bottom);

        Console.WriteLine((right - left) *
                          (top - bottom));

    }
}


public class cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return next();
    }

    public static int ni() {
        return int.Parse(next());
    }

    public static long nextLong() {
        return long.Parse(next());
    }

    public static double nextDouble() {
        return double.Parse(next());
    }

}


Measured memory_bytes: 2648
mod = 10**9+7
inv_2 = pow(2, mod-2, mod)
N, M, K = map(int, input().split())
def make_fact(n):#0~nの階乗を求める
    fact = [1]*(n+1)
    for i in range(1, n+1):
        fact[i] = fact[i-1]*i%mod
    return fact

def make_fact_inv(n):#0~nの階乗のmodに関する逆元を求める
    fact_inv = [1]*(n+1)
    fact_inv[n] = pow(fact[n], mod-2, mod)#フェルマーの小定理
    for i in range(n, 0, -1):
        fact_inv[i-1] = fact_inv[i]*i%mod
    return fact_inv

def comb(n, k):#nCk
    return fact[n]*fact_inv[k]*fact_inv[n-k]%mod
fact = make_fact(N*M)
fact_inv = make_fact_inv(N*M)
Sum = [0]*(max(N, M)+1)
for i in range(1, len(Sum)):
    Sum[i] = (Sum[i-1]+i)%mod
ans = 0

for x in range(1, N+1):
    for y in range(1, M+1):
        ans+=(Sum[x-1]+Sum[N-x])*M+(Sum[y-1]+Sum[M-y])*N
        ans%=mod
print(ans*comb(N*M-2, K-2)*inv_2%mod)

Measured memory_bytes: 44144
#include <stdio.h>
#include <algorithm>

using namespace std;

struct node {
	long long a , b , c , d;
	long long val;
} s[1200000];
long long cnt;
long long n;
long long C[111][111];
long long ans;
long long out[1200] , tot , num;
bool cmp ( node x1 , node x2 ) {
	return x1.val < x2.val;
}
void add ( long long a , long long b , long long c , long long d ) {
	long long i;
	for ( i = 1 ; i <= a ; i++ )
		out[++tot] = num + 1;
	for ( i = 1 ; i <= b ; i++ )
		out[++tot] = num + 2;
	for ( i = 1 ; i <= c ; i++ )
		out[++tot] = num + 1;
	for ( i = 1 ; i <= d ; i++ )
		out[++tot] = num + 2;
	num += 2;
}
long long get ( long long a , long long b , long long c , long long d ) {
	long long i , j;
	long long ret = 0 , t1 , t2 , t3;
	double x1 , x2 , x3 , x4;
	ret += (1ll<<(a+c-1)) - 1;
	ret += (1ll<<(b+d-1)) - 1;
	if ( ret > 1000000000000ll ) return -1;
	for ( i = 1 ; i <= a && i <= c ; i++ ) {
		for ( j = 1 ; j <= b && j <= d ; j++ ) {
			x1 = C[a][i]; x2 = C[b][j]; x3 = C[c][i]; x4 = C[d][j];
			if ( x1*x2*x3*x4 > 1e12 ) return -1;
			t1 = C[a][i] * C[b][j];
			t1 = t1 * C[c][i];
			t1 = t1 * C[d][j];
			ret += t1;
		}
	}
	return ret;
}
void work () {
	long long i , j , k , l , t;
	scanf ( "%lld" , &n );
	C[0][0] = 1;
	for ( i = 1 ; i <= 50 ; i++ ) {
		C[i][0] = 1;
		for ( j = 1 ; j <= i ; j++ ) {
			C[i][j] = C[i-1][j-1] + C[i-1][j];
			//printf ( "%lld " , C[i][j] );
		}
		//printf ( "\n" );
	}
	//i = 12;
	//printf ( "%lld\n" , get(i,i,i,i) );
	for ( i = 1 ; i <= 20 ; i++ ) {
		for ( j = 1 ; j <= 20 ; j++ ) {
			for ( k = 1 ; k <= 20 ; k++ ) {
				for ( l = 1 ; l <= 20 ; l++ ) {
					t = get(i,j,k,l);
					if ( t == -1 ) continue;
					cnt++;
					s[cnt].a = i;
					s[cnt].b = j;
					s[cnt].c = k;
					s[cnt].d = l;
					s[cnt].val = t;
					//printf ( "%d %d %d %d %lld\n" , i , j , k , l , get ( i , j , k , l ) );
				}
			}
		}
	}
	sort ( s + 1 , s + 1 + cnt , cmp );
	for ( i = cnt ; i >= 1 ; i-- ) {
		if ( s[i].val <= n ) {
			n -= s[i].val;
			ans += s[i].a+s[i].b+s[i].c+s[i].d;
			add ( s[i].a , s[i].b , s[i].c , s[i].d );
		}
	}
	//printf ( "%lld %lld\n" , n , ans );
	while ( n ) {
		out[++ans] = num + 1;
		out[++ans] = num + 1;
		num++;
		n--;
	}
	printf ( "%lld\n" , ans );
	for ( i = 1 ; i <= ans ; i++ ) {
		printf ( "%lld%c" , out[i] , i==ans?'\n':' ' );
	}
}
int main () {
	work ();
	return 0;
}


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

using namespace std;

int read();

int n, root;
int a[200005], up[200005];
vector<int> e[200005];
void add(int f, int t) { e[f].push_back(t), e[t].push_back(f); }
void dfs(int u, int fa) {
  if (e[u].size() == 1) return up[u] = a[u], void();
  int mx = 0, sum = 0;
  for (int i = 0, v; i < (int)e[u].size(); ++i)
    if ((v = e[u][i]) != fa) dfs(v, u), sum += up[v], mx = max(mx, up[v]);
  up[u] = 2 * a[u] - sum;
  if (up[u] < 0 || up[u] > a[u] || a[u] < mx) puts("NO"), exit(0);
}

int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  if (n == 2) return puts(a[1] == a[2] ? "YES" : "NO"), 0;
  for (int i = 1, u, v; i < n; ++i) u = read(), v = read(), add(u, v);
  for (int i = 1; i <= n; ++i)
    if (e[i].size() > 1) root = i;
  dfs(root, 0), puts(up[root] ? "NO" : "YES");
  return 0;
}

int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}


Measured memory_bytes: 16640
s = input().split(' ')
n = int(s[0])
l = int(s[1])
if l > 0:
  m = (l + n+l-1) * n / 2 - l
  print(int(m))
elif l < 0 and (n+l-1) < 0:
  m = (l + n+l-1) * n / 2 - (n+l-1)
  print(int(m))
else:
  m = (l + n+l-1) * n / 2
  print(int(m))

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

#define rp(i, k, n) for (int i = k; i < n; i++)
#define ll  long long
ll ed(ll a, ll b) {
    ll c = max(a, b);
    ll d = min(a, b);
    ll instant;
    while (c % d != 0) {
        instant = c;
        c = d;
        d = instant % d;
    }
    return d;
}

int main() {
    ll N, X;
    cin >> N >> X;
    vector<ll> map(N);
    ll now;
    rp(i, 0, N) {
        cin >> now;
        map.at(i) = abs(now - X);
    }
    ll ans = map.at(0);
    rp(i, 1, N) {
        ans = ed(ans, map.at(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
// Author : Koushal Bhat
// arraysum : count of subarrays with sum k
#define forr(i,p,n) for( ll i=p; i<n; i++)
#define forn(i,p,n) for(ll i=p; i<=n; i++)
#define rev(i,n,p) for(ll i=n; i>=p; i--)
#define PI 3.14159265358979323846

ll fact (ll n)
{
    ll res=1;
    if(n==1)return 1;
    while(n>1)
    {
        res=res*n;
        n--;
    }
    return res;
}
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n=0;
    cin>>n;
    vector<ll> v(n);
    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
    }
    ll count=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            if(v[i]==v[j] || i==j)continue;
            for(ll k=0;k<n;k++)
            {
                if(j==k || k==i || v[j]==v[k]  || v[k]==v[i])continue;
                if(v[i]+v[j]>v[k]  && v[i]+v[k]>v[j]  && v[k]+v[j]>v[i] )
                {
                   // cout<<i+1<<" "<<j+1<<" "<<k+1<<'\n';
                    count++;
                }
            }
        }
    }
    cout<<count/6<<'\n';
    return 0;
}


Measured memory_bytes: 3652
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b,c = readInts()
dic = defaultdict(int)
start = a
while True:
    if start % b == c:
        print('YES')
        exit()
    if dic[start%b] == 1:
        print('NO')
        exit()
    dic[start%b] = 1
    #print(start%b)
    start += a


Measured memory_bytes: 10344
A = []
n, m = map(int, input().split())
for i in range(n):
    a = list(map(int, input().split()))
    a.append(sum(a))
    A.append(a)

B = []
for j in range(m + 1):
    B.append(0)

for k in A:
    for l,o in enumerate(k):
        B[l] += o

A.append(B)
for i in A:
    for j,k in enumerate(i):
        if j == 0:
            print(k,end="")
        else:
            print("",k,end="")
    print()


Measured memory_bytes: 6752
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[105];
	int N;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>a[i];
	}
	sort(a,a+N);
	int sum = 1;
	for(int i=1;i<N;i++)
	{
		if(a[i]>a[i-1]) sum++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define lla(s) s.rbegin(),s.rend()
#define pcnt(b) __builtin_popcount(b)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ll INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,c,ans = 0;
    cin>>a>>b>>c;
    
    if(a==b&&b==c&&(a%2==0)){cout<<-1<<endl;}
    else{
        while(1){
            if((a%2) || (b%2) || (c%2)){break;}
            int A = b/2+c/2;
            int B = a/2+c/2;
            int C = b/2+a/2;
            a = A;b = B;c = C;
            if((a==b)&&(b==c)){ans = -1;break;}
            ans++;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
alpha2num = lambda c: ord(c) - ord('A') + 1
num2alpha = lambda c: chr(c+64)

N = input()
S = input()

hoge1 = list(S)
hoge2 = [int(alpha2num(s)) + int(N) for s in hoge1]
hoge3 = [t - 26 if t > 26 else t for t in hoge2]
hoge4 = [num2alpha(t) for t in hoge3]

print(''.join(hoge4))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

Measured memory_bytes: 256
#import<map>
long h,w,a,b,c,d,D[10]={0,2,2,1,2,0,1,1},t[10],i;std::map<long,int>m;main(){for(*t=(scanf("%d%d%*d",&h,&w)-h)*(2-w);~scanf("%d%d",&a,&b);i=0)for(;i<9;)if((c=a+D[i])>2&(d=b+D[++i])>2&c<=h&d<=w)t[c=m[c*w+d]++]--,t[c+1]++;for(;i<10;)printf("%ld ",t[i++]);}

Measured memory_bytes: 56448
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#include <iomanip>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll mod = 1e9 + 7;

string S;

ll N, K,D;
ll L, R;

ll ans=1e9;
ll AV[2019];
ll mp[2020];



int main() {

	cin >> L >> R;
	ll modL = L % 2019;
	ll modR = R % 2019;
	if(R > L + 2018) {
		FOR(i, 0, 2019) {
			mp[i] = 1;
		}
	}
	else if (R % 2019 > L % 2019) {
		FOR(i, L % 2019, R % 2019 + 1) {
			mp[i] = 1;
		}
	}
	else {
		FOR(i, L % 2019, 2019) {
			mp[i] = 1;
		}
		FOR(i, 0, R % 2019 + 1) {
			mp[i] = 1;
		}
	}
	FOR(i, 0, 2019) {
		FOR(j, i+1, 2019) {
			if (mp[i] == 1 && mp[j] == 1) {
				ans = min(ans, (i*j) % 2019);
			}
		}
	}
	cout << ans << endl;
  
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int ans, t, n, h[100], i, j, up, down;
  scanf("%d",&t);
  for( j = 0 ; j < t ; j++ ){
    up = 0;
    down = 0;
    scanf( "%d",&n );
    for( i = 0 ; i < n ; i++ )
      scanf("%d",&h[i]);
    for( i = 0 ; i < (n-1) ; i++ ){
      if( h[i+1] > h[i] ){
	ans = h[i+1] - h[i];
	if(ans > up){
	  up = ans;
	}
      }else{
	ans = h[i] - h[i+1];
	if(ans > down){
	  down = ans;
	}
      }
    }
    printf("%d %d\n",up,down);
  }
  return 0;
}

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

typedef long long ll;

const int MAXW = 1e5+2, MAXN = 100;
ll dp[MAXN][MAXW], n, W, w[MAXN], v[MAXN];

ll backtrack(int i, ll cap){
    if(i == n || cap == 0) return 0;
    if(dp[i][cap] != -1) return dp[i][cap];
    if(w[i] > cap)
        dp[i][cap] = backtrack(i+1, cap);
    else
        dp[i][cap] = max(backtrack(i+1, cap), backtrack(i + 1, cap - w[i]) + v[i]);
    return dp[i][cap];
}

int main(){
    // freopen(".in", "r", stdin);

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n >> W;
    for(int i=0; i<n; i++)
        cin >> w[i] >> v[i];

    for(int i=0; i<n; i++)
        for(int j=0; j<=W; j++)
            dp[i][j] = -1;

    cout << backtrack(0, W) << endl;

    return 0;
}

Measured memory_bytes: 78336
sou = lambda n: 2 ** (n + 2) - 3
ptn = lambda n: 2 ** (n + 1) - 1


def pate(lv, x):
    if x == 0:
        return 0
    if x < 0:
        return -1
    else:
        for i in range(lv + 1):
            if x < lv - i + sou(i):
                i -= 1
                re = ptn(i) + 1 + pate(i, x - (lv - i + sou(i) + 1))
                return re
        else:
            return ptn(lv)


lv, x = map(int, input().split())
print(pate(lv, x))


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  int n;
  string s;
  cin >> n;
  if (n >= 30) cout << "Yes" << endl;
  else cout << "No" << endl; 

  return 0;
}


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

int main() {
    int h, n, sco = 0;
    string Yes, No;
    cin >> h >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
        sco += a.at(i);
    }
    if (h <= sco) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 640
import bisect

def solve():
    N = int(input())
    a = list(map(int, input().split()))
    b = []
    c = [0] * (N)

    M = 0

    for i in range(N - 1, -1, -1):
        if i >= N // 2:
            if a[i] == 1:
                b.append(i+1)
                c[i] = 1
                M += 1
            else:
                c[i] = 0
        else:
            num = i
            cnt = 0
            j = 2
            while (i+1) * j <= N:
                num = (i+1) * j
                cnt += c[num-1]
                j += 1
            if cnt % 2 == 0:
                if a[i] == 0:
                    c[i] = 0
                else:
                    b.append(i+1)
                    c[i] = 1
                    M += 1
            else:
                if a[i] == 0:
                    b.append(i+1)
                    c[i] = 1
                    M += 1
                else:
                    c[i] = 0
    
    print(M)
    if M != 0:
        print(*b)
    
    


if __name__ == '__main__':
    solve()


Measured memory_bytes: 74984
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

int n, m;
ll INF = 20000000000000;
ll v[1005], a[2005], b[2005], c[2005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	FOR(i, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--;
		b[i]--;
		c[i] = -c[i];
	}
	fill(v, v + n, INF);
	v[0] = 0;
	FOR(cnt, n) {
		FOR(i, m) {
			if (v[a[i]] != INF && v[b[i]] > v[a[i]] + c[i]) {
				v[b[i]] = v[a[i]] + c[i];
			}
		}
	}
	ll ans1 = -v[n-1];
	FOR(cnt, n) {
		FOR(i, m) {
			if (v[a[i]] != INF && v[b[i]] > v[a[i]] + c[i]) {
				v[b[i]] = v[a[i]] + c[i];
			}
		}
	}
	ll ans2 = -v[n-1];
	if (ans1 == ans2) cout << ans1 << endl;
	else cout << "inf" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;

const double PI = acos(-1);

int main() {
  int a;	
  cin >> a;
  printf("%.20lf",2*PI*a);
  return 0;
}


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

int main()
{
	ll n,m;
	cin >> n >> m;
	ll sum = 0;
	vector<ll> A(n);
	for(ll i = 0;i<n;i++)
	{
		cin >> A[i];
		sum += A[i];
	}
	ll cnt = 0;
	for(ll i = 0;i<n;i++)
	{
		if(A[i]*4*m>=sum)cnt++;
	}
	if(cnt>=m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
const int N=400002;
int n,m,i,a,b,c[N],vis[N],sum,tmp;
char s[N];
vector<int>e[N];
void Link(int x,int y){
	e[x].push_back(y);
	e[y].push_back(x);
}
void init(){
	scanf("%s%d",s+1,&m);
	n=strlen(s+1);
	for(i=0;i<=n;i++)
		c[i]=s[i+1]-s[i];
	for(i=0;i<n-i;i++)
		Link(i,n-i);
	while(m--){
		scanf("%d%d",&a,&b);
		Link(a-1,b);
	}	
}
void dfs(int i){
	vis[i]=1;
	sum+=c[i];
	for(int j=0;j<e[i].size();j++)
		if(!vis[e[i][j]])
			dfs(e[i][j]);
}
void work(){
	tmp=1;
	dfs(0);
	sum=0;
	for(i=1;i<n;i++)
		if(!vis[i]){
			dfs(i);
			if(sum%26)
				tmp=0;
		}
	printf("%s\n",tmp?"YES":"NO");
}
int main(){
	init();
	work();
	return 0;
}

Measured memory_bytes: 18748
import sys
n, k = map(int, sys.stdin.readline().split())
m, l = n // k, n % k
if k % 2 > 0:
  ans = m * m * m
else:
  x = m
  if l >= k // 2:
    x += 1
  ans = m * m * m + x * x * x
print(ans)


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














int A, B, M;
int a[101010], b[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B >> M;
	rep(i, 0, A) cin >> a[i];
	rep(i, 0, B) cin >> b[i];

	int mi_a = inf;
	rep(i, 0, A) chmin(mi_a, a[i]);

	int mi_b = inf;
	rep(i, 0, B) chmin(mi_b, b[i]);

	int ans = mi_a + mi_b;
	rep(i, 0, M) {
		int x, y, c; cin >> x >> y >> c;
		y--; x--;
		chmin(ans, a[x] + b[y] - c);
	}
    cout << ans << endl;
}







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

#define INF 100100100
#define MOD 1000000007

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

using namespace std;
using ll = long long;
using ull = unsigned long long ;

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N,T;
   cin >> N >> T;
   int c,t,ans=INF;
   FOR(i,N){
      cin >> c >> t;
      if(t <= T){
         ans = min(ans,c);
      }
   }
   if(ans == INF) cout << "TLE" << endl;
   else cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define fora(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define ford(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define foraf(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define fordf(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

int iINF = 2147483647;
ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

int main() {
	string str;
	int d = 'A' - 'a';
	
	while (getline(cin, str)) {
		for (int i=0; i<(int)str.size(); i++) {
			if (str[i]==' ' || str[i]=='.') continue;
			str[i] += d;
		}
		cout << str << endl;
	}
	
	return 0;
}

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

int main() {
	int n,ans = 0;;
	cin >> n;
	for(int i=1;i<=n;i++) {
		int x = i,cnt = 0;
		while(x) cnt ++,x /= 10;
		if(cnt&1) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = [int(readline()) for _ in range(N)]
    m = sum(S)
    if m % 10 != 0:
        print(m)
    else:
        mi = [s for s in S if s % 10 != 0]
        if len(mi):
            print(m - min(mi))
        else:
            print(0)
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-

n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = 0
for i in range(1, n+1):
    if i <= k:
#        print(x)
        ans += x
    else:
#        print(y)
        ans += y

print(ans)

Measured memory_bytes: 3060
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException ‚There is no more input";}else{var returnInput = this.list[this.index++];return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var L = one[1];
  var list = new Array(N);
  var sum = 0;
  var min = 10000000;
  for(var i = 0; i < N; i++){
    list[i] = L + i;
    sum += list[i];
  }
  var output = 0;
  for(var i = 0; i < N; i++){
    var tmpsum = 0;
    for(var j = 0; j < N; j++){
      if(i != j){
        tmpsum += list[j];
      }
    }
    if(min > Math.abs(sum - tmpsum)){
      min = Math.abs(sum - tmpsum);
      output = tmpsum;
    }
  }
  myout(output);
}


Measured memory_bytes: 30132
import java.util.Scanner;
 
public class Main {
	static Scanner in = new Scanner(System.in);
 
	public static void main(String[] args) {
		int sx = in.nextInt(), sy = in.nextInt(), tx = in.nextInt(), ty = in.nextInt();
 
		for(int i = 0; i < ty- sy; i++){
			System.out.print("U");
		}
		for(int i = 0; i < tx- sx; i++){
			System.out.print("R");
		}
		for(int i = 0; i < ty- sy; i++){
			System.out.print("D");
		}
		for(int i = 0; i < tx- sx; i++){
			System.out.print("L");
		}
		System.out.print("L");
		for(int i = 0; i < ty- sy + 1; i++){
			System.out.print("U");
		}
		for(int i = 0; i < tx- sx + 1; i++){
			System.out.print("R");
		}
		System.out.print("DR");
		for(int i = 0; i < ty- sy + 1; i++){
			System.out.print("D");
		}
		for(int i = 0; i < tx- sx + 1; i++){
			System.out.print("L");
		}
		System.out.println("U");
	}
}

Measured memory_bytes: 23616
def kaibun(bun):
    n=len(bun)
    flag=1
    for i in range(int(n/2)):
        if bun[i]!=bun[n-1-i]:
            flag=2
            break
    return(flag)

s=input()
N=len(s)

a=kaibun(s)

ss=s[:int((N-1)/2)]
sss=s[int((N+3)/2)-1:]

b=kaibun(ss)
c=kaibun(sss)

if a+b+c==3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    int n,k,p;
    int i;

    scanf("%d",&n);
    for(i=0;i<n;i++){
	scanf("%d%d",&k,&p);
	if(k%p==0) printf("%d\n",p);
	else printf("%d\n",k%p);
    }

    return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(0);

	int n,k,q,x;
	cin >> n >> k >> q;
	vector<int>a(n+1,0);
	for(int i=0;i<q;i++){
		cin >> x;
		a[x]++;
	}

	for(int i=1;i<=n;i++){
		if(q-a[i]>=k) puts("No");
		else puts("Yes");
	}

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
#include<iomanip>
#include<string.h>
#include<cstdio>
#include<cstdlib>
#include<stack>

using namespace std;

int partition(int a[], int j, int r){
  int x = a[r];
  int i = j - 1;

  while(j < r){
    if(a[j] <= x){
      i++;
      swap(a[i], a[j]);
    }
    j++;
  }
  swap(a[++i], a[r]);
  return i;
}

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

  int q = partition(a, 0, n - 1);


  for(int i = 0; i < n - 1; i++){
    if(i == q){
      cout << "[" << a[i] << "] ";
    }
    else cout << a[i] << " ";
  }
  if(q == n - 1){
    cout << "[" << a[n - 1] << "]" << endl;
  }
  else cout << a[n - 1] << endl;


}


Measured memory_bytes: 3468
#include <iostream>
#include <vector>
#include <queue>

using namespace std; 

int noc;
vector<int> comp;
vector< vector<int> > adj;

void dfs(int v) {
	comp[v] = noc;
	for (int i = 0; i < adj[v].size(); ++i) {
		if (comp[adj[v][i]] < 0) {
			dfs(adj[v][i]);
		}
	}
	return;
}

int main(void) {
	int nov,noe,u,v;
	cin >> nov >> noe;
	adj = vector< vector<int> >(nov);
	for (int i = 0; i < noe; ++i) {
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	noc = 0;
	comp = vector<int>(nov,-1);
	for (int i = 0; i < nov; ++i) {
		if (comp[i] < 0) {
			++noc;
			dfs(i);
		}
	}

	int noq;
	cin >> noq;
	for (int q = 0; q < noq; ++q) {
		cin >> u >> v;
		if (comp[u] == comp[v]) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 12128
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

const int MAX = 100001;

int main() {
	int N;
	int C[MAX];
	int S[MAX];
	int F[MAX];

	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		cin >> C[i] >> S[i] >> F[i];
	}

	for (int i = 0; i < N; i++) {
		int time = 0;
		for (int j = i; j < N - 1; j++) {
			int t = S[j];
			while (time > t)t += F[j];
			time = t + C[j];
		}
		cout << time << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

vll fac(2,1),inv(2,1),finv(2,1) ;

ll ncr(ll n,ll r){
	if(n<0||r<0||n<r) return 0 ;
	if(n==r||r==0) return 1 ;
	return fac.at(n)*finv.at(n-r)%mod*finv.at(r)%mod ;
}

ll nhr(ll n,ll r){return ncr(n+r-1,n-1) ;}

int main(){
	ll n,m ;
	cin >> n >> m ;
	for(int i=2;i<=300000;i++){
		fac.emplace_back(fac.at(i-1)*i%mod) ;
		inv.emplace_back(mod-inv.at(mod%i)*(mod/i)%mod) ;
		finv.emplace_back(finv.at(i-1)*inv.at(i)%mod) ;
	}
//	cout << -1 << endl ;
	ll ans = 1 ;
	map<ll,ll> p ;
	for(ll i=2;i*i<=m;i++){
		while(m%i==0){
			p[i]++ ;
			m /= i ;
		}
	}
	if(m!=1) p[m]++ ;
//	cout << -2 << endl ;
	for(auto i:p){
//		cout << i.first << " " << i.second << endl ;
		ans = ans*nhr(n,i.second)%mod ;
	}
	cout << ans << endl ;
}


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

int main() {
	int n = 0;
	cin >> n;
	vector<int> number(n - 1), junior(n);
	for (int i = 0; i < n - 1; i++) {
		cin >> number.at(i);
	}
	for (int i = 0; i < n - 1; i++) {
		junior.at(number.at(i) - 1)++;
	}
	for (int i = 0; i < n; i++) {
		cout << junior.at(i) << endl;
	}
}

Measured memory_bytes: 4844
n=int(input())
l=list(map(int, input().split()))
ans=0
cnt=0
for i in range(n-1):
  if l[i+1]<=l[i]:
    cnt+=1
    if i==n-2:
      ans=max(ans, cnt)
  else:
    ans=max(ans, cnt)
    cnt=0
print(ans)

Measured memory_bytes: 20460
from collections import deque


n = int(input())
s = [input() for i in range(n)]


graph = [[] for i in range(n)]
#二部グラフ判定
for i in range(n):
    for j in range(i+1, n):
        if s[i][j] == "1":
            graph[i].append(j)
            graph[j].append(i)

q = ([0])
visited = [-1]*n
visited[0] = 0
is_2graph = True
while q:
    pos = q.pop()
    for next_pos in graph[pos]:
        if visited[next_pos] == -1:
            visited[next_pos] = visited[pos] ^ 1
            q.append(next_pos)
        else:
            if visited[pos]^1 != visited[next_pos]:
                is_2graph = False
if not is_2graph:
    print(-1)
    exit()


INF = 10**9
dp = [[INF]*n for i in range(n)]
for i in range(n):
    dp[i][i] = 0

for i in range(n):
    for j in range(n):
        if s[i][j] == "1":
            dp[i][j] = 1
            dp[j][i] = 1

for k in range(n):
    for i in range(n):
        for j in range(n):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

ans = 0
for i in range(n):
    for j in range(n):
        ans = max(ans, dp[i][j]) 
print(ans + 1)

Measured memory_bytes: 44140
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

void die(){
  print(-1);
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, a, b;
  cin >> n >> a >> b;
  if(a*b<n) die();
  if(a+b>n+1) die();
  vll c(b, 1);
  {
    ll k = n-b;
    rep(i, b){
      ll p = min(a-1, k);
      c[i] += p;
      k -= p;
    }
  }
  dump(c);
  vll d = c;
  rep(i, b-1){
    d[i+1]+=d[i];
  }
  vll ans;
  rep(i, b)rep(j, c[i]){
    ans.emplace_back(n+1-d[i]+j);
  }
  print(ans);
}


Measured memory_bytes: 9676
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int n,x,y,b,p,ans;
  scanf("%d",&n);
  while(n--){
    scanf("%d %d %d %d",&x,&y,&b,&p);
    ans = x*b+y*p;
    if(b>=5&&p>=2){
      ans = ans/5*4;
    } else {
      b = max(b,5);
      p = max(p,2);
      ans = min(ans,(x*b+y*p)/5*4);
    }
    printf("%d\n",ans);
  }
  return(0);
}



Measured memory_bytes: 2712
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!

const Main = (p)=>{
	// 1行目がinput[0], 2行目がinput[1], …に入る
	
	let t = parseInt(p)//p.split(" ").map(Number);
	//文字列から10進数に変換するときはparseIntを使います
	//出力
	let s=0;
	while(t>0){
	    if(t%3!=0&&t%5!=0){
	        s+=t;
	    }
	    t--;
	}
	console.log(s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  string A,B;
  cin >> A >> B;
  int cnt=0;
  for (int i=0; i<A.length(); i++){
    if(A.at(i)!=B.at(i)){
      cnt++;
    }
  }
      
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3864
#cmb
mod=10**9+7
MAX=2*10**5+100

g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
    num_1=g1[-1]*i%mod
    g1.append(num_1)
    g2.append(pow(num_1,mod-2,mod))
    
def cmb(n,r,MOD):
    return g1[n]*g2[r]*g2[n-r]%MOD

h,w,a,b=map(int,input().split())
ans=0
for i in range(1,h-a+1):
    ans=(ans+cmb(i+b-2,i-1,mod)*cmb(h-i+w-b-1,h-i,mod))%mod

print(ans)

Measured memory_bytes: 67100
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fo(i,n) for(i=0;i<n;i++)
#define fok(i,k,n) for(i=k;i<n;i++)
#define ci(x) cin>>x;
#define ci2(x,y) cin>>x>>y;
#define co(x) cout<<x<<"\n";
#define co2(x,y) cout<<x<<" "<<y<<"\n";
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;

int main() {
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	cout<<abs(a[0]-a[1])+abs(a[1]-a[2])<<"\n";
	
	return 0;
}


Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
m=max(A)+1
B=A[:]
C=[0]*m
for a in A:C[a]+=1
for i in range(1,m):C[i]+=C[i-1]
for j in A[::-1]:B[C[j]-1]=j;C[j]-=1
print(*B)


Measured memory_bytes: 224380
def base_10_to_n_ex(x, n=4):
    d, m = divmod(x, n)
    mm = '0' if m == 0 else '3' if m == 1 else '5' if m == 2 else '7'
    if d:
        return base_10_to_n_ex(d, n) + mm
    return mm


n = int(input())
i = 27
s = '357'
ans = 0
while int(s) <= n:
    if '3' in s and '5' in s and '7' in s and '0' not in s:
        ans += 1
    i += 1
    s = base_10_to_n_ex(i)
print(ans)


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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    cout << (n*(n-1))/2 + (m*(m-1))/2 << "\n";
    return 0;
}



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

int main(){
	int n;
    cin >>n;
   vector<int> vec(n);
    string res;
    res="YES";
    
  for (int j=0;j<n;j++)    cin >>vec.at(j);
  sort(vec.begin(),vec.end());
  for(int i=0;i<n-1;i++){
    if(vec.at(i)==vec.at(i+1)){res="NO";break;}
  }
cout<<res<<endl;    
}

Measured memory_bytes: 1152
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
int main()
{
    int a,b,c;
    double s,h,tes,rad,tei,teia;
    std::cin >> a >> b >> c;
    //syuu no nagasa wo dasu
    rad=c*M_PI/180;
    tes=a*a+b*b-2*a*b*cos(rad);
    tes=sqrt(tes);
    s=a+b+tes;
    //menseki wo dasu
    tei=s/2;
    teia=tei*(tei-a)*(tei-b)*(tei-tes);
    teia=sqrt(teia);
    //takasa wo dasu
    h=teia*2/a;
    //syousuu de hyouji
    printf("%.8f ", teia);
    printf("%.8f ", s);
    printf("%.8f \n", h);
    return 0;
}

Measured memory_bytes: 3468
s = gets.chomp
if s[0] != "A"
  puts "WA"
  exit
end
if s[2..s.length-1].count("C") != 1 || s[1] == "C" || s[-1] == "C" 
  puts "WA"
  exit
end
s.delete!("A")
s.delete!("C")
if s != s.downcase
  puts "WA"
  exit
end
puts "AC"

Measured memory_bytes: 1788
#include <iostream>
#include<set>
#include<vector>
#include<string>
#include<iterator>
#include<iomanip>
#include<cmath>
#include<map>
#include<string.h>
#include<algorithm>

using namespace std;
void ll(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(0);
}

int main() {

	ll();
	
	string s,t;
	cin >> s >> t;
	reverse(s.begin(), s.end());

	if (t == s)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;


void solve(){
    vi v(26, 0);
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        v[s[i] - 97]++;
        if(v[s[i] - 97] > 1){
            cout << "no";
            return;
        }
    }
    cout << "yes";
}
int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}


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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

constexpr int MOD = 1e9 + 7;
// taken from saketh-are
template<typename T> 
struct matrix {
    int N;
    vector<T> dat;

    matrix<T> (int _N, T fill = T(0), T diag = T(0)) {
        N = _N;
        dat.resize(N * N, fill);

        for (int i = 0; i < N; i++)
            (*this)(i, i) = diag;
    }

    T& operator()(int i, int j) {
        return dat[N * i + j];
    }

    matrix<T> operator *(matrix<T> &b) {
        matrix<T> r(N);

        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
                for (int k = 0; k < N; k++)
                    r(i, j) = r(i, j) + (*this)(i, k) * b(k, j);

        return r;
    }

    vector<T> operator *(vector<T> &v) {
        vector<T> r(N, T(0));

        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                r[i] = r[i] + (*this)(i, j) * v[j];
            }
        }

        return r;
    }

    matrix<T> pow(ll expo) {
        if(!expo) return matrix<T>(N, T(0), T(1));
        matrix<T> r = (*this * *this).pow(expo/2);
        return (expo&1) ? (r * *this) : r;
    }

    friend ostream& operator<<(ostream &os, matrix<T> &m) {
        os << "{";
        for (int i = 0; i < m.N; i++) {
            if(i) os << "},\n ";
            os << "{";
            for (int j = 0; j < m.N; j++) {
                if(j) os << ", ";
                os << setw(00) << m(i, j) << setw(0);
            }
        }
        return os << "}}";
    }
};

struct mll {
    ll val;
    mll(ll _val = 0) {
        val = _val % MOD;
        if (val < 0) val += MOD;
    }

    bool operator==(const mll& other) const {
        return val == other.val;
    }

    mll operator+(const mll &o) {
        return mll((val + o.val) % MOD);
    }

    mll operator*(const mll &o) {
        return mll((val * o.val) % MOD);
    }

    friend ostream& operator<<(ostream &os, mll &m) {
        return os << m.val;
    }
};


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

    int n;
    ll k;
    cin >> n >> k;

    matrix<mll> mat(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            int x;
            cin >> x;
            mat(i, j) = x;
        }
    }
    
    matrix<mll> powed = mat.pow(k);
    mll res(0);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            res = res + powed(i, j);
        }
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 1536