akhauriyash/Code-Regression huggingface dataset:
#define _ 2<<17
n,i;A[_],B[_],T[_],F[_];long M,D[_],P[_],R[_];s(u,p,i,I){D[u]=1;for(i=F[u];I=B[i];i=T[i])I-p?s(I,u),D[u]=D[u]*-~D[I]%M:0;}S(u,p,x,i,I){for(m(i=F[u],p);I=B[i];I-p?S(I,u,R[i]*x%M+1,0,0),x=x*-~D[I]%M:0)i=T[i];P[u]=x%M;}m(i,p){i?m(T[i],p),R[i]=R[T[i]]*(B[i]-p?-~D[B[i]]:1)%M:0;}main(u,v){for(;~scanf("%d%d",&u,&v);)i++?A[i-1]=B[i]=u,B[i-1]=A[i++]=v:(n=u,M=v);for(;--i;F[A[i]]=i)T[i]=F[A[i]];s(*R=1,0);S(1,0,1);for(;i++<n;)printf("%d\n",P[i]);}

Measured memory_bytes: 15744
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		long n = Console.ReadLine().ToLong();
		
		long r = n / 11 * 2;
		long t = n - (n / 11)*11;
		if(t >= 1 && t <= 6)
			r++;
		else if(t > 6)
			r+=2;
		
		Console.WriteLine(r);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    ll a ,b, c,d; cin >> a >> b >> c >> d;
    ll x = a * c , y = a * d , z = b * c , k =  b * d;
    cout << max4(x, y, z, k);
    
}
   

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

int main() {
  string s;
  cin >> s;
  s[0]=(s[0]-'a'+1)+'a';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

def main():
    input = sys.stdin.readline
    H, W, D = map(int, input().split())
    d = [0] * (H*W + 1)

    for i in range(H):
        row = list(map(int, input().split()))
        for j in range(W):
            d[row[j]] = [i, j]

    A = [0] * (H*W + 1)
    for l in range(H * W - D, 0, -1):
        a = d[l]
        b = d[l+D]
        A[l] = A[l+D] + abs(a[0] - b[0]) + abs(a[1] - b[1])

    Q = int(input())
    for _ in range(Q):
        L, R = map(int, input().split())
        print(A[L] - A[R])


if __name__ == '__main__':
    main()

Measured memory_bytes: 17328
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
int main(){
  char str;
  char SA[101],SB[101],SC[101];
  queue<char> quea;
  queue<char> queb;
  queue<char> quec;
  cin>>SA>>SB>>SC;
  int la=strlen(SA);
  int lb=strlen(SB);
  int lc=strlen(SC);
  for(int i=0;i<la;i++) quea.push(SA[i]);
  for(int i=0;i<lb;i++) queb.push(SB[i]);
  for(int i=0;i<lc;i++) quec.push(SC[i]);
  str=quea.front();quea.pop();
  while(1){
    if(str=='a'){
      if(quea.size()==0){
        printf("A\n");return 0;
      }else {
        str=quea.front();quea.pop();
      }
    }
    else if(str=='b'){
      if(queb.size()==0){
        printf("B\n");return 0;
      }else {
        str=queb.front();queb.pop();
      }
    }
    else if(str=='c'){
      if(quec.size()==0){
        printf("C\n");return 0;
      }else {
        str=quec.front();quec.pop();
      }
    }
  }
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author /\
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DChristmas solver = new DChristmas();
        solver.solve(1, in, out);
        out.close();
    }

    static class DChristmas {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long x = in.nextLong();
            out.println(findPatty(n, x));
        }

        long findPatty(int level, long layer) {
            long tot = 1;
            for (long i = 0; i < level; i++) {
                tot *= 2;
                tot += 3;
            }
            if (level == 0) {
                return 1;
            }

            if (layer == 1) {
                return 0;
            } else if (layer == tot) {
                return 2 * findPatty(level - 1, (tot - 3) / 2) + 1;
            } else if (layer == (tot + 1) / 2) {
                return 1 + findPatty(level - 1, (tot - 3) / 2);
            } else {
                if (layer <= tot / 2) {
                    return findPatty(level - 1, layer - 1);
                } else {
                    return findPatty(level - 1, (layer - 1) % (tot / 2)) +
                            findPatty(level - 1, (tot - 3) / 2) + 1;
                }
            }
        }

    }

    static class Scanner {
        private StringTokenizer st;
        private BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 23380
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void dp (int lim, int[] value, int[] weight) {
		int[][] dp = new int[value.length + 1][lim + 1];

		for (int i = 0; i < dp.length; i++)
			Arrays.fill(dp[i], -1);

		dp[0][0] = 0;

		for (int i = 0; i < value.length; i++) {
			for (int j = 0; j < dp[i].length; j++) {
				if (dp[i][j] == -1) continue;
				dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j]);
				if (j + weight[i] > lim) continue;
				dp[i + 1][j + weight[i]] = Math.max(dp[i + 1][j + weight[i]], dp[i][j] +value[i] );
			}
		}

		int retValue = 0, retWeight = 0;;
		for (int i = 0; i < dp[0].length; i++) {
			if (retValue < dp[dp.length - 1][i]) {
				retWeight = i;
				retValue = dp[dp.length - 1][i];
			}
		}

		System.out.println(retValue + "\n" + retWeight);

	}

	public static void main(String[] args) throws IOException {

		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));

		for (int i = 1; ; i++) {
			int lim = Integer.parseInt(br.readLine());
			if (lim == 0) break;
			int cnt = Integer.parseInt(br.readLine());
			int[] value = new int[cnt];
			int[] weight = new int[cnt];
			for (int j = 0; j < cnt; j++) {
				String[] str = br.readLine().split(",");
				value[j] = Integer.parseInt(str[0]);
				weight[j] = Integer.parseInt(str[1]);
			}
			System.out.println("Case " + i + ":");
			dp(lim, value, weight);
		}

	}

}

Measured memory_bytes: 28560
#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 whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    int n, k;
    cin >> n >> k;
    vector<bool> b(n);
    rep(i, k) {
        int d;
        cin >> d;
        rep(j, d) {
            int a;
            cin >> a;
            a--;
            b[a] = true;
        }
    }
    int ans = 0;
    rep(i, n) {
        if (!b[i]) ans++;
    }
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

h, w, d = getList()
INF = 1000000000

revindex = [(0, 0) for i in range(h*w)]
acc = [0 for i in range(h*w)]

white = 0
for i in range(h):
    a = getList()
    for j, num in enumerate(a):
        revindex[num-1] = (i, j)

for i in range(d):
    tmp = 0
    idx = i

    while(True):
        pa, pb = revindex[idx]
        idx += d
        if idx >= w * h:
            break
        pc, pd = revindex[idx]
        tmp += (abs(pa - pc) + abs(pb - pd))
        acc[idx] = tmp


q = getN()
for i in range(q):
    f, l = getList()
    print(acc[l-1] - acc[f-1])

# print(acc)


Measured memory_bytes: 58364
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <vector>
#include <stack>
#include <memory>
using namespace std;
const int MAX=100005;
const int NIL=-1;

struct node{
    int p,l,r;
    int depth;
};
node t[MAX];
int n;

void print(int u)
{
    cout<<"node "<<u<<": ";
    cout<<"parent = "<<t[u].p<<", ";
    cout<<"depth = "<<t[u].depth<<", ";
    if (t[u].p==NIL) {
        cout<<"root, ";
    }
    else if(t[u].l==NIL) cout<<"leaf, ";
    else cout<<"internal node, ";
    cout<<"[";
    for (int i=0,c=t[u].l; c!=NIL; i++,c=t[c].r) {
        if (i) {
            cout<<", ";
        }
        cout<<c;
    }
    cout<<"]"<<endl;
}

void rec(int u,int p)
{
    t[u].depth=p;
    if (t[u].r!=NIL) {
        rec(t[u].r, p);
    }
    if (t[u].l!=NIL) {
        rec(t[u].l, p+1);
    }
}
int main()
{
    //freopen("/Users/mac/Desktop/C++?¨????/test/test.txt", "r", stdin);
    int d,v,c,l = 0,root = 0;
    cin>>n;
    for (int i=0; i<n; i++) {
        t[i].p=t[i].l=t[i].r=t[i].depth=NIL;
    }
    for (int i=0;i<n; i++) {
        cin>>v>>d;
        for (int j=0; j<d; j++) {
            cin>>c;
            if (j==0) {
                t[v].l=c;
            }
            else{
                t[l].r=c;
            }
            l=c;
            t[c].p=v;
        }
    }
    for (int i=0; i<n; i++) {
        if (t[i].p==NIL) {
            root=i;
        }
    }
    rec(root, 0);
    for (int i=0; i<n; i++) {
        print(i);
    }
    return 0;
}

Measured memory_bytes: 7724
def gcd(a, b):
    if a < b:
        return gcd(b, a)
    return a if b == 0 else gcd(b, a % b)


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

left = [0 for _ in range(N + 1)]
right = [0 for _ in range(N + 1)]

for i in range(N):
    left[i + 1] = gcd(left[i], A[i])

for i in range(N - 1, -1, -1):
    right[i] = gcd(right[i + 1], A[i])

print(max([gcd(left[i], right[i + 1]) for i in range(N)]))


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

int dp[223456][3];
bool used[223445][3];
long long n, a[312312], b[312312], c[312312];
int mx;
vector <int> v[5];
int mn = 50102031;

long long f = 1, s;
int main() {
   
   cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], f = (a[i] * f / __gcd(a[i], f));
	for(int i = 1; i <= n; i++) s += f / a[i];
	cout << fixed << setprecision(18) << f * 1. / s;
	  
}



Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct{
  double x;
  double y;
}P;

void curve(int,P,P);

int main()
{
  int n;
  P p1,p2;

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;

  scanf("%d",&n);
  if(n<0 || n>6) exit(1);


  printf("%.8f %.8f\n",p1.x,p1.y);
  curve(n,p1,p2); // p1とp2の間に三角形を作る
  printf("%.8f %.8f\n",p2.x,p2.y);
  
  return 0;
}

void curve(int n,P p1,P p2)
{
  P s,t,u; //３等分した点、s>u>tで三角形を形成
  double rad;

  rad = M_PI*60.0/180.0; //60度をラジアンに変える
  if(n==0) return;

  s.x = ((2.0*p1.x)+(1.0*p2.x))/3.0;
  s.y = ((2.0*p1.y)+(1.0*p2.y))/3.0;
  t.x = ((1.0*p1.x)+(2.0*p2.x))/3.0;
  t.y = ((1.0*p1.y)+(2.0*p2.y))/3.0;
  u.x = (t.x-s.x)*cos(rad)-(t.y-s.y)*sin(rad)+s.x;
  u.y = (t.x-s.x)*sin(rad)+(t.y-s.y)*cos(rad)+s.y; //s,t,uそれぞれの座標を決定

  curve(n-1,p1,s); // p1とsの間に三角形を作る
  //printf("s:");
  printf("%.8f %.8f\n",s.x,s.y);
  curve(n-1,s,u); // sとuの間に三角形を作る
  //printf("u:");
  printf("%.8f %.8f\n",u.x,u.y);
  curve(n-1,u,t); // uとtの間に三角形を作る
  //printf("t:");
  printf("%.8f %.8f\n",t.x,t.y);
  curve(n-1,t,p2); // tとp2の間に三角形を作る

}



Measured memory_bytes: 2108
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        char x = scan.next().toCharArray()[0];
        if ('A' <= x && x <= 'Z') {
            System.out.println("A");
            return;
        }
        System.out.println("a");
    }
}


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


int main() {
	unsigned long long a, b;
	cin >> a >> b;
	if (a == 1 || b == 1) {
		cout << 1 <<endl;
	}
	else cout << (a*b+1) / 2 <<endl;
	return 0;
}

Measured memory_bytes: 3600
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

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

void solve () {

}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif

	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a == b && a == c) {
		printf("Yes\n");
	}	else {
		printf("No\n");
	}
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin>>x;
    ll tmp = 100;
    ll ans = 0;
    while(tmp<x){
        tmp = tmp + (tmp /100);
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3648
V, E, r = map(int, input().split())
inf = 2**32
e = []
for i in range(E):
    s, t, d = map(int, input().split())
    e.append([s, t, d])

# 始点からの距離初期化
distance = [inf]*V
distance[r] = 0

'''
ベルマンフォード法による単一最短経路
負の重みがある場合でも大丈夫だが、負の重みがない場合はダイクストラのほうがよい
O(V*E)
'''


def bellmanFord():
    for v in range(V):
        updated = False
        for s, t, d in e:
            if distance[s] != inf and (distance[s]+d) < distance[t]:
                distance[t] = distance[s]+d
                updated = True
        if v == (V-1) and updated:
            return False
    return True


b = bellmanFord()
if b:
    for v in range(V):
        print(distance[v] if distance[v] != inf else "INF")
else:
    print("NEGATIVE CYCLE")



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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    int N, T; cin >> N >> T;
    int V[N];
    int right_max[N]; //right_max[i]はV[i]からV[N-1]までの最大値
    rep(i, N)
        cin >> V[i];

    //right_maxを埋めていく
    right_max[N-1] = V[N-1];
    for(int i = N-2; i >= 0; i--){
        if(V[i] > right_max[i+1]) right_max[i] = V[i];
        else right_max[i] = right_max[i+1];
    }

    vector<int> ans;
    rep(i, N)
        ans.push_back(right_max[i]-V[i]);

    sort(ans.begin(), ans.end(), greater<int>());
    rep(i, N) if(ans[i] != ans[0]){ cout << i << endl; break;}
    return 0;
}

void solve(){}

Measured memory_bytes: 1660
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=10000
etemp=1
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(5)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)


Measured memory_bytes: 10536
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        float a = sc.nextFloat();
        int[] places = new int[n];
        for (int i = 0; i < n; i++) places[i] = sc.nextInt();

        List<Float> temperatures = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            temperatures.add((float) (t - places[i] * 0.006));
        }

        float nearest = temperatures.stream().min((x, y) -> Float.compare(Math.abs(a - x), Math.abs(a - y))).get();
        System.out.println(temperatures.indexOf(nearest) + 1);
    }
}

Measured memory_bytes: 34604
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = list(map(int, sr()))
K = ir()
dp_dec = [0] * (K+1)
dp_reserved = [0] * (K+1)
dp_reserved[0] = 1
for x in N:
    prev = dp_dec[:]
    # 0の場合はそのままの値
    for k in range(K):
        dp_dec[k+1] += prev[k] * 9  # 1-9の場合
    if x > 0:
        for k in range(K+1):
            dp_dec[k] += dp_reserved[k]  # 0の場合
            if k < K:
                dp_dec[k+1] += dp_reserved[k] * (x - 1)  # 1-9の場合
        dp_reserved[1:] = dp_reserved[:-1]
        dp_reserved[0] = 0

answer = dp_dec[K] + dp_reserved[K]
print(answer)
# 07

Measured memory_bytes: 3192
MOD = (10 ** 9) + 7
n, k  = map(int, input().split())
a = list(map(int, input().split()))
 
negs = [-x for x in a if x < 0]
non_negs = [x for x in a if x >= 0]
 
if len(non_negs) == 0 and k % 2 == 1:
    negs.sort()
    ans = 1
    for i in range(k):
        ans = ans * -negs[i] % MOD
    print(ans)
    exit()
 
negs_p, non_negs_p = 0, 0
 
negs.sort(reverse = True)
non_negs.sort(reverse = True)
 
for i in range(k):
    if negs_p == len(negs):
        non_negs_p += 1
    elif non_negs_p == len(non_negs):
        negs_p += 1
    elif negs[negs_p] > non_negs[non_negs_p]:
        negs_p += 1
    else:
        non_negs_p += 1
 
if negs_p % 2 == 0 or k == n:
    ans = 1
    for i in range(negs_p):
        ans = ans * -negs[i] % MOD
    for i in range(non_negs_p):
        ans = ans * non_negs[i] % MOD
    print(ans)
    exit()
 
if negs_p == len(negs) or non_negs_p == 0:
    negs_p -= 1
    non_negs_p += 1
    ans = 1
    for i in range(negs_p):
        ans = ans * -negs[i] % MOD
    for i in range(non_negs_p):
        ans = ans * non_negs[i] % MOD
    print(ans)
    exit()
 
if non_negs_p == len(non_negs) or negs_p == 0:
    negs_p += 1
    non_negs_p -= 1
    ans = 1
    for i in range(negs_p):
        ans = ans * -negs[i] % MOD
    for i in range(non_negs_p):
        ans = ans * non_negs[i] % MOD
    print(ans)
    exit()
 
 
a = negs[negs_p - 1]
b = negs[negs_p]
c = non_negs[non_negs_p - 1]
d = non_negs[non_negs_p]
 
if a * b > c * d:
    negs_p += 1
    non_negs_p -= 1
else:
    negs_p -= 1
    non_negs_p += 1
 
ans = 1
for i in range(negs_p):
    ans = ans * -negs[i] % MOD
for i in range(non_negs_p):
    ans = ans * non_negs[i] % MOD
print(ans)

Measured memory_bytes: 31716
from __future__ import division
import math
from collections import deque

N,C,K = map(int, raw_input().split())

T = [input() for i in xrange(N)]
T.sort()
#print T
minT = T[0]
minTidx = 0
lenT = len(T)
bus = 0

for i in xrange(lenT):
    v = T[i]

    diffH = v - minT
    diff = i - minTidx
    if diffH > K:
        bus += 1
        minTidx += min(C,diff)
        minT = T[minTidx]
#        print(i,"diffH>K",bus,minTidx,minT)

    diff = i - minTidx
    if i==lenT-1:
        cnt = math.ceil((diff+1) / C)
        bus += cnt
#        print(i,"last", cnt, bus)
    else:
        diff = i - minTidx
        if (diff+1) >= C:
            bus += 1
            minTidx += C
            minT = T[minTidx]
#            print(i,"(diff+1)>=C",bus,minTidx,minT)


print int(bus)      
    


Measured memory_bytes: 6448
#data=list(input().split())
s=input()
last='.'
ans=0
for i in s:
    if last=='.':
        last=i
        continue
    if last==i:
       # print('Bad')
        ans=1
        break
    last=i
if ans==1:
    print('Bad')
else:
    print('Good')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,i1,n) for(int i=(int)(i1);i<(int)(n);i++)
#define ll long long
#define vi vector<int>
#define vll vector<long long>
using graph = vector<vector<int>>;

int main() {
  int n;
  cin>>n;
  vector<pair<int,int>> vec(105);
  rep(i,0,n){
    cin>>vec.at(i).first>>vec.at(i).second;
  }
  
  int count=0;
  rep(i,0,n){
    if(vec.at(i).first==vec.at(i).second){
      count++;
    }else{
      count=0;
    }
    if(count==3){
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No";
}

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define forr(i,a,b) for(ll i=(a);i<=(b);i++)
#define ford(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define size(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)



int main(void) {
    long int N,ans=0,M,i;
    cin >> N;
    cin >> M;
    int n[10000];
    for(i=0;i<M;++i){
       cin >> n[i];
    }
       for (i=0;i<M;++i){
        ans = ans + n[i];
    }


    
if(N<ans){
    cout << -1 << "\n";
}
  else{
      cout << N-ans << "\n";
  } 

  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>

using namespace std;

int main(){
    int n; cin >> n;
    vector<vector<pair<int, bool>>> xys(n, vector<pair<int, bool>>());
    for(int i=0; i<n; ++i){
        int a; cin >> a;
        for(int j=0; j<a; ++j){
            int x, y; cin >> x >> y;
            --x;
            xys[i].push_back({x, y==1});
        }
    }
    int ans=0;
    for(int i=0; i<(1<<n); ++i){
        bool found=true;
        int num_bit=0;
        for(int j=0; j<n; ++j){
            if(!(i & (1<<j))) continue;
            else ++num_bit;
            for(auto& p : xys[j]){
                if((!!(i & (1<<p.first))) != p.second){
                    found=false;
                    break;
                }
            }
            if(!found) break;
        }
        if(found){
            ans=max(ans, num_bit);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	for (int n; cin >> n, n != 0; ) {
		vi a(n);
		rep(i, n) cin >> a[i];
		int ans = -1000000;
		rep(i, n) {
			int sum = 0;
			REP(j, i, n - 1) ans = max(ans, sum += a[j]);
		}
		cout << ans <<endl;
	}
	
	return 0;
}

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

using ll = long long;

ll A[2010];
ll T[2010];

int main(){
    ll N, x;
    cin >> N >> x;
    ll ans = 0;
    for(ll i=0; i<N; i++){
        cin >> A[i];
        T[i] = A[i];
        ans += T[i];
    }

    for(ll p=1; p<N; p++){
        ll sum = p * x;
        for(ll i=0; i<N; i++){
            T[i] = min(T[i], A[(i-p+N)%N]);
            sum += T[i];
        }
        ans = min(ans, sum);
    }
    cout << ans << endl; 
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include <set>
#include<iomanip>
#include<map>
#include<unordered_map>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

//----------------------------------------


int main(void)
{
	int n;



	cin >> n;
	ll ans = 0;

	map<string, ll> moji;

	rep(i, n)
	{
		string s;
		cin >> s;
		sort(s.begin(), s.end());


		ans += moji[s];
		moji[s] ++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 11136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
         
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
        try {
             
            String s = br.readLine();
            StringTokenizer st;
             
            while (s != null) {
                st = new StringTokenizer(s);
                int p =Integer.parseInt(st.nextToken()) + Integer.parseInt(st.nextToken()) ;
                 
                System.out.println((int)Math.log10(p)+1);
                s =br.readLine();
            }
 
        } catch (Exception ex) {
            System.exit(0);
        }
    }
 
}

Measured memory_bytes: 24284
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(k,i,n) for(int i = (k); i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> Pii;

int main() {
    int n;cin>>n;
    priority_queue<Pii,vector<Pii>,greater<Pii>> que;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        que.push(Pii(b,a));
    }
    int x=0;
    rep(i,n){
        int a=que.top().second,b=que.top().first;
        que.pop();
        x+=a;
        if(x>b){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <set>

const long long MOD = 1000000007;

using namespace std;



int main(void) {

    long long i, j;
    long long n, k;
    long long sum = 0;
    long long temp;
    long long min, max;
    long long a, b, c, d;
    set<string> st;
    string s;

    cin >> n;

    for (i = 0; i < n; i++) {
        cin >> s;
        st.insert(s); 
    }

    cout << st.size() << endl;

    return 0;
}

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

using namespace std;


int dp[4000][4000];

vector<char>res;

int main()
{
    string s,t;
    cin>>s>>t;
    dp[0][0]=0;
    for(int i=1;i<=s.size();i++)
    {
        for(int j=1;j<=t.size();j++)
        {
             if(s[i-1] == t[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
            else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    int n,m;
    n=s.size();
    m=t.size();
    while(n > 0 && m > 0)
    {
        if(s[n-1]==t[m-1])
        {
            res.push_back(s[n-1]);
            n--;
            m--;
        }
        else if(dp[n-1][m]>=dp[n][m-1])n--;
        else m--;
    }
    for(int i=res.size()-1;i>=0;i--)
    {
        cout<<res[i];
    }

}


Measured memory_bytes: 47488
from collections import *

N, X, D = map(int, input().split())

if D==0:
    if X==0:
        print(1)
    else:
        print(N+1)
        
    exit()
    
l = []

for i in range(N+1):
    L = i*(i-1)//2
    U = i*(2*N-i-1)//2
    
    if D>0:
        l.append((i*X+L*D, U-L+1))
    else:
        l.append((i*X+U*D, U-L+1))

d = defaultdict(list)

for li in l:
    d[li[0]%abs(D)].append(li)

ans = 0

for v in d.values():
    m = min(vi[0] for vi in v)
    lr = []
    
    for vi in v:
        l = (vi[0]-m)//abs(D)
        r = l+vi[1]-1
        lr.append((l, r))
        
    events = []
    
    for li, ri in lr:
        events.append((li, 1))
        events.append((ri+1, -1))
    
    events.sort(key=lambda t: t[0])
    now = 0
    
    for event in events:
        now += event[1]
        
        if now==0:
            ans += event[0]-left
        elif event[1]==1 and now==1:
            left = event[0]

print(ans)

Measured memory_bytes: 133008
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	counts := make([]int, 100010)
	sum := 0
	for i := range A {
		fmt.Scan(&A[i])
		counts[A[i]]++
		sum += A[i]
	}

	var Q int
	fmt.Scan(&Q)

	bs := make([]int, Q)
	cs := make([]int, Q)
	for i := 0; i < Q; i++ {
		fmt.Scan(&bs[i], &cs[i])
	}
	for i := 0; i < Q; i++ {
		b, c := bs[i], cs[i]
		sum += counts[b] * (c - b)
		counts[c] += counts[b]
		counts[b] = 0
		fmt.Println(sum)
	}

}


Measured memory_bytes: 7284
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let n = get!(usize);
    let mut v = vec![vec![0; 26]; n];
    for i in 0..n {
        let tmp: Vec<char> = get!(String).chars().collect();
        for j in tmp.iter() {
            v[i][*j as usize - 97] += 1;
        }
    }
    let mut v2 = vec![1 << 30; 26];
    for i in 0..26 {
        for j in 0..n {
            if v[j][i] == 0 {
                v2[i] = 0;
                continue;
            }
            //eprintln!("v[{}][{}] = {}", j, i, v[j][i]);
            v2[i] = std::cmp::min(v2[i], v[j][i]);
        }
    }
    let mut ans = String::new();
    for i in 0..26 {
        if v2[i] != 0 {
            for _ in 0..v2[i] {
                ans += &((i as u8 + 97) as char).to_string();
            }
        }
    }
    println!("{}", ans);
}


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

using namespace std;

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

    vector<vector<int> > vec(m);

    for(int i = 0 ; i<m ;++i){
        int k; cin >> k;
        vec[i].resize(k);
        for(int j = 0 ; j < k ; ++j){
            cin >> vec[i][j];
            --vec[i][j];
        }
    }
    vector<int> p(m);
    for(int i = 0; i < m; ++i){
        cin >> p[i];
    }

    int ans = 0;
    for(int i = 0; i < (1 << n) ; ++i){
        bool flag = true;
        for(int j = 0; j < m ; ++j){
            int c = 0;
            for(int id : vec[j]){
                if(1 & (i >> id)){

                 ++c;
                }

            }
            c %= 2;
            if(c != p[j]){
                flag = false;
            }

        }
        if(flag){
             ++ans;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define INT_MAX 2147483647

using namespace std;

long long n, a, b;

int main()
{ 
    cin >> n >> a >> b;
    long long ans = (n-2)*(b-a)+1;
    if(ans<0) 
    {
    	cout << 0 << endl;
    	return 0;
    }
    cout << ans << endl;
}

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

// AtCoder Educational DP -F LCS
// 解説見た。ヘナチョコだね。

// dp[N, M]。それぞれ何文字目かをあらわす。

// 例えば、N文字目=M文字目であるとき、dp[N-1,M-1] + 1が現在の長さと言える。
// ただしこのとき、dp[N-1,M]もしくはdp[N,M-1]の方が大きいのならば、そちらでよいだろう。

// なぜ解説みないとわからなかったか？
// そもそも、dpが加算されるタイミングと、dpの配列をしっかり考えれていなかった。なんとかしましょう



public class Program{

	public static void Main(){
		
	
		var inputA = Console.ReadLine().ToCharArray();
		var inputB = Console.ReadLine().ToCharArray();
		
		
		var dp = new int[inputA.Length + 1,inputB.Length + 1];
		
		
		for(int A = 1; A <= inputA.Length; A++){
		
			for(int B = 1; B <= inputB.Length; B++){
			
				if(inputA[A-1] == inputB[B-1]){
					dp[A,B] = Math.Max(dp[A-1,B-1]+1, dp[A,B]);
				}
				
				dp[A,B] = Math.Max(dp[A-1,B], dp[A,B]);
				dp[A,B] = Math.Max(dp[A,B-1], dp[A,B]);
			
			
			}
		
		}
		
		/* dp tracking
		for(int i = 0; i <= inputA.Length; i++){
			for(int k = 0; k <= inputB.Length; k++) Console.Write(dp[i,k]);
			Console.WriteLine();
		}
		Console.WriteLine(dp[inputA.Length,inputB.Length]);
		*/
		
		int wA = inputA.Length;
		int wB = inputB.Length;
		string hoge = "";
		
		while(wA > 0 && wB > 0){
		
			if(dp[wA,wB] == dp[wA-1,wB]){
				wA--;
				continue;
			}
		
			if(dp[wA,wB] == dp[wA,wB-1]){
				wB--;
				continue;
			}
			
			if(dp[wA,wB] -1 == dp[wA-1,wB-1]){
				hoge += inputA[wA-1];
				wA--;
				wB--;
				continue;
			}
		
		}
		
		Console.WriteLine(new string(hoge.Reverse().ToArray()));
		
		
		
		
	}




}

Measured memory_bytes: 50260
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
   int t,n,x,y,c[2000]={},m;
   vector<long long int> v,v1,v2;
   vector< pair <long long int,long long int> >p,p1,p2;
   set<long long int> st;
   priority_queue<long long int> pq;
   cin>>n>>x>>y;
   for(int i=1;i<n;i++)
   {
      for(int j=i+1;j<=n;j++)
      {
         m=min(j-i,abs(x-i)+1+abs(y-j));
         m=min(m,abs(x-j)+1+abs(y-i));
         //cout<<m<<endl;
         c[m]++;
      }
   }
   for(int i=1;i<n;i++)
      cout<<c[i]<<endl;
   return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
b=a.copy()
ma=max(a)
a.remove(ma)
ma2 = max(a)
for i in range(n):
    if b[i]==ma:
        print(ma2)
    else:
        print(ma)

Measured memory_bytes: 14068
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    int ans = -INF;
  	chmax(ans,n+m);
  	chmax(ans,n-m);
  	chmax(ans,n*m);
    cout << ans << "\n";
}


Measured memory_bytes: 256
hp_t, at_t, hp_a, at_a = list(map(int, input().split()))

if(hp_t%at_a == 0 ):
    # 青木の攻撃回数
    num_a = hp_t // at_a
else:
    num_a = hp_t // at_a + 1

if(hp_a%at_t == 0 ):
    # 高橋の攻撃回数
    num_t = hp_a // at_t
else:
    num_t = hp_a // at_t + 1

if(num_a >= num_t):
    print("Yes")
else:
    print("No")

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

int main(void)
{
    long long h = 0;
    long long w = 0;
    cin >> h >> w;

    long long canmove = 0;
    if (h == 1 || w == 1)
    {
        canmove = 1;
    }
    else if (h % 2 == 0)
    {
        canmove = h / 2 * w;
    }
    else
    {
        if (w % 2 == 0)
        {
            canmove = h * w / 2;
        }
        else
        {
            canmove = (h - 1) / 2 * w + (w + 1) / 2;
        }
    }

    cout << canmove;

    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<int>;

#define rep(i, n)  for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
#define pout(n, a) cout << fixed << setprecision(n) << (a)
#define Cast(dig, n) static_cast<std::bitset<(dig)>>(n)

const int INF = 2147483647;
const ll  MOD = 1000000007;

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

    ll ans = 0;
    for(int i = 1; i <= n; ++i) {
        if(i % 15 != 0 && i % 5 != 0 && i % 3 != 0) ans += i;
    }

    cout << ans;
}

Measured memory_bytes: 3636
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

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


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    int x = read(), a = read();
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;

    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int M = GetInt();
		var H = GetInts(N);
		var ng = new bool[N];
		for(int i = 0; i < M; i++)
		{
			int A = GetInt() - 1;
			int B = GetInt() - 1;
			if(H[A] < H[B])
				ng[A] = true;
			else if(H[A] > H[B])
				ng[B] = true;
			else
			{
				ng[A] = true;
				ng[B] = true;
			}
		}
		WriteLine(N - ng.Count(x => x));
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 46920
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext())
		{
			int be =sc.nextInt()*3600+sc.nextInt()*60+sc.nextInt();
			int af =sc.nextInt()*3600+sc.nextInt()*60+sc.nextInt();
			int sum = af -be;
			System.out.println(sum/3600+" "+(sum%3600)/60+" "+sum%60);
		}
	}
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

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



int main()
{
  int x, y; cin >> x >> y;
  cout << x+y/2 << endl;
}


Measured memory_bytes: 3544