akhauriyash/Code-Regression huggingface dataset:
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
/////////////////////////////////////////

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

    double n;cin >> n;
    cout << 2.0 * n * 3.14159265 << '\n';
}

Measured memory_bytes: 3804
import itertools

n,m,q=map(int,input().split())
num=[int(i) for i in range(1,m+1)]
x=[]
for i in range(q):
    a,b,c,d=map(int,input().split())
    a,b=a-1,b-1
    x.append([a,b,c,d])
ans=0
for i in itertools.combinations_with_replacement(num,n):
    s=0
    for j in x:
        if i[j[1]]-i[j[0]]==j[2]:
            s+=j[3]
    ans=max(ans,s)
print(ans)



Measured memory_bytes: 9208
#include <iostream>
int main(void){
	int n,a,b,c,d;
	std::cin>>n;
	while(n--){
		std::cin>>a>>b>>c;
		if (a>b){d=a;a=b;b=d;};
		if (b>c){d=b;b=c;c=d;};
		std::cout<<(a*a+b*b==c*c?"YES\n":"NO\n");
	}
}

Measured memory_bytes: 1120
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, Q;

int main()
{
	int i, j, k;
	ll A, B, K;
	scanf("%lld%lld%lld", &K, &A, &B);
	if (B <= A || K < A - 1|| B == A + 1) {
		printf("%lld", K + 1);
	}
	else {
		K -= (A - 1);
		ll cookie = A;
		cookie += (B - A)*(K / 2) + K % 2;
		printf("%lld", cookie);
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

typedef long long ll;

inline ll read()
{
	ll x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}

ll tims;
ll t[55];

inline bool judge(ll v)
{
	return v>=0 && v<=1e16+1000ll;
}

int main()
{
	ll k=read();
	if(k<1)
	{
		printf("2\n");
		if(k&1ll)
			printf("%lld %lld\n",(k>>1)+2,k>>1);
		else
			printf("%lld %lld\n",k>>1,(k>>1)+1);
	}
	else
	{
		tims=0;
	
		while(tims<=50)
		{
			for(ll i=50;i>=2;i--)
				if(!(k%i))
				{
					ll inc=k/i;
					for(ll j=1;j<=tims;j++)
					{
						t[j]=inc+i-(tims-j);
						if(!judge(t[j]))
							goto nxt;
					}
					for(int j=tims+1;j<=i;j++)
					{
						t[j]=inc+j-1-tims;
						if(!judge(t[j]))
							goto nxt;
					}
					printf("%lld\n",i);
					for(int j=1;j<=i;j++)
						printf("%lld%c",t[j]," \n"[j==i]);
					goto end;
				}

			nxt:;
			k--;
			tims++;
		}

		while(1);
		puts("yoo");
	}		

	end:;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        int table[] = new int[10001];
 
        for(int i = 0; i <= 10000; i++){
            table[i] = 1;
        }
 
        int limit = (int)Math.sqrt(10000);
        for(int i = 2; i <= limit; i++){
            if(table[i] == 1){
                for(int k = 2*i; k <= 10000; k += i){
                    table[k] = 0;
                }
            }
        }
 
        ArrayList<Integer> prime = new ArrayList<Integer>();
        for(int i = 2; i <= 10000; i++){
            if(table[i] == 1){
                prime.add(Integer.valueOf(i));
            }
        }
 
        Scanner scanner = new Scanner(System.in);
 
        int N = scanner.nextInt();
        int input,tmp,count = 0;
        boolean FLG;
 
        for(int loop = 0; loop < N; loop++){
            input = scanner.nextInt();
 
            FLG = false;
            for(int i = 0; i < prime.size(); i++){
                tmp = prime.get(i);
                if(input%tmp == 0 && (input/tmp) > 1){
                    FLG = true;
                    break;
                }
                if(tmp*tmp > input){
                    break;
                }
            }
            if(!FLG)count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 43768
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  int ans = 0,m = 0;
  rep(i,0,n) {
    int p;
    cin >> p;
    ans += p;
    m = max(m,p);
  }
  ans -= m/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<ll, ll> II;
typedef pair<int, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n;
ll x, d;
map<ll, vector<II> > ma;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> x >> d;
    if (d == 0) {
        if (x == 0) cout << 1;
        else cout << n+1;
        return 0;
    }
    if (d < 0) {
        x = -x;
        d = -d;
    }
    ll l = 0, r = 0;
    ma[0].push_back(II(0,0));

    FOR(k,1,n) {
        ll X = (x % d + d) % d;
        ll p = X * k % d;
        ll w = x * k / d;
        l += k-1;
        r += n-k;
        // cout << p << ' ' << l << ' ' << r << endl;
        if (l > r) continue;
        ma[p].push_back(II(l + w, r + w));
    }
    ll res = 0;
    FORALL(it, ma) {
        sort(ALL(it->SE));
        ll l = -1, r = -1;
        bool setLR = false;
        FOR(i,0,SZ(it->SE)-1) {
            if (!setLR) {
                l = it->SE[i].FI;
                r = it->SE[i].SE;
                setLR = true;
                continue;
            }
            if (r < it->SE[i].FI) {
                res += (r - l + 1);
                l = it->SE[i].FI;
            }
            r = max(r, it->SE[i].SE);
        }
        if (setLR) res += (r - l + 1);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 22144
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    ll A[N+1];
    for(int i = 1; i < N + 1; i++) cin >> A[i];
    map<int, int> mp; //keyにA[i] + iの値を、valueに、j番目までで出てきたA[i] + iの個数を代入する
    ll ans = 0;
    for(int i = 1; i < N + 1; i++){
        int right = i - A[i]; //jの値とみる
        ans += mp[right];
        int left = i + A[i]; //iの値とみる
        mp[left]++; //leftに該当するkeyがない場合は自動で生成されて、1が代入される。
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 22172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};
constexpr ll mod = 1e9+7;

ll N, K;
VVL G;

ll dfs(ll from, ll now){
    if(K < G[now].size()) return 0;
    ll usable;
    if(from == -1) usable = K-1;
    else usable = K - 2;
    ll comb = 1;
    if(from == -1){
        rep(i, 0, G[now].size()){
            comb *= (usable - i);
            comb %= mod;
        }
    }else{
        rep(i, 0, G[now].size()-1){
            comb *= (usable - i);
            comb %= mod;
        }
    }
    ll ret = 1;
    for(auto g : G[now]){
        if(g == from) continue;
        ret *= dfs(now, g);
        ret %= mod;
    }
    ret *= comb;
    ret %= mod;
    return ret;
}

int main(){
    cin >> N >> K;
    G.resize(N);
    rep(i, 0, N-1){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    cout << (K * dfs(-1, 0)) % mod << endl;
    return 0;
}

Measured memory_bytes: 11520
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace kyoupuro {

    class MainClass {

        public static void Main() {

            var N = Input.NextInt();
            var K = Input.NextInt();
            var list = Input.IntList();

            for (int i = N; i < 100000; i++) {
                if(i.ToString().ToCharArray().Select(x => x - '0').All(x => !list.Contains(x))) {
                    Console.WriteLine(i);
                    return;
                }
            }
        }
    }

    class Input {
        static IEnumerator<string> enumerator;

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            if (enumerator == null || !enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
                enumerator.MoveNext();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            if (enumerator == null || !enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
                enumerator.MoveNext();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13380
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const ll inf = 1e18;
const int mod = 1e5;
const int MAX = 1e6;

int main() {
    int n, m;
    cin >> n >> m;
    vll a(n);
    vll c(n+1,0);
    map<ll,ll> ct;
    rep(i,n) cin >> a[i];
    ct[0]++;
    REP(i,n+1) {
        c[i] = (c[i-1] + a[i-1]) % m;
        ct[c[i]]++;
    }
    ll ans = 0;
    for (auto pt = ct.begin(); pt != ct.end(); pt++) {
        ll x = pt->second;
        ans += x*(x-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5760
class BonusInfo(var isHeadB : Boolean, var isTailA : Boolean) {
}

fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val s = mutableListOf<String>()
    (1..N).forEach {
        s.add(readLine()!!)
    }
    var basicCount = 0
    var maxBonusCount = 0

    var bothCount = 0
    var onlyHeadBCount = 0
    var onlyTailACount = 0

    s.forEach { si ->
        var AAppeared = false
        var len = si.length
        val bonusInfo = BonusInfo(false, false)
        si.forEachIndexed { index, c ->
            if (index == 0 && c == 'B') {
                bonusInfo.isHeadB = true
            }
            if (index == (len - 1) && c == 'A') {
                bonusInfo.isTailA = true
            }

            if (index == (len - 1)) {
                if (bonusInfo.isHeadB && bonusInfo.isTailA) {
                    bothCount++
                } else if(bonusInfo.isHeadB) {
                    onlyHeadBCount++
                } else if(bonusInfo.isTailA) {
                    onlyTailACount++
                }
            }

            if (c == 'A') {
                AAppeared = true
            } else if (c == 'B') {
                if (AAppeared) {
                    basicCount++
                }
                AAppeared = false
            } else {
                AAppeared = false
            }
        }
    }
    var tailAUsed = false
    if (onlyTailACount > 0) {
        onlyTailACount--
        tailAUsed = true
    }

    if (bothCount > 0) {
        if (tailAUsed) {
            maxBonusCount++
        }
        maxBonusCount += (bothCount - 1)
        tailAUsed = true
    }
    if (tailAUsed && onlyHeadBCount > 0) {
        onlyHeadBCount--
        maxBonusCount++
    }
    maxBonusCount += listOf(onlyHeadBCount, onlyTailACount).min()!!
    println(basicCount + maxBonusCount)
}

Measured memory_bytes: 42908
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;

int n,m,l;
int s,t,q;
LL fuel[305][305];//计算dist
int add[305][305];//加多少次油
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m>>l;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j){
            fuel[i][j]=INF;
            add[i][j]=INF;
        }
        fuel[i][i]=0;
        add[i][i]=0;
    }
    while(m--){
        int a,b,c;
        cin>>a>>b>>c;
        fuel[a][b] = fuel[b][a] = c;
    }
    cin>>q;
    for(int k=1;k<=n;++k){
        for(int i=1;i<=n;++i){
            for(int j=1;j<=n;++j){
                fuel[i][j]=min(fuel[i][j],fuel[i][k]+fuel[k][j]);
            }//把图中任意两点之间的dist计算出来
        }
    }
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j){
            if(i == j)
                continue;
            if(fuel[i][j]<=l){
                add[i][j]=min(add[i][j],1);
            }
        }
    }
    for(int k=1;k<=n;++k){
        for(int i=1;i<=n;++i){
            for(int j=1;j<=n;++j){
                add[i][j]=min(add[i][j],add[i][k]+add[k][j]);
            }
        }
    }
    while(q--){
        cin>>s>>t;
        if(add[s][t]<INF)
            cout<<add[s][t]-1<<"\n";
        else
            cout<<-1<<"\n";
    }
    return 0;
}


Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Solve.Answer();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var n = IO.ReadInt;

            var l = new List<long>();
            l.Add(2);
            l.Add(1);
            for (int i = 2; i <= n; i++)
            {
                l.Add(l[i - 2] + l[i - 1]);
            }
            WriteLine(l[n]);
        }

        public class IO
        {
            #region Input
            public static string ReadString => ReadLine();
            public static int ReadInt => int.Parse(ReadLine());
            public static long ReadLong => long.Parse(ReadLine());
            public static double ReadDouble => double.Parse(ReadLine());

            public static List<string> ReadSplitString => ReadLine().Split().ToList();
            public static List<int> ReadSplitInt => ReadLine().Split().Select(s => int.Parse(s)).ToList();
            public static List<long> ReadSplitLong => ReadLine().Split().Select(s => long.Parse(s)).ToList();
            public static List<double> ReadSplitdouble => ReadLine().Split().Select(s => double.Parse(s)).ToList();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");

            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }

        public static long GCD(long x, long y)
        {
            #region
            if (x < y)
            {
                var tmp = x;
                x = y;
                y = tmp;
            }
            while (true)

            {
                if (x % y == 0)
                {
                    return y;
                }
                else
                {
                    var tmp = x;
                    x = y;
                    y = tmp % y;
                }
            }
            #endregion
        }

        public static long Choice2(long n)
        {
            #region
            if (n <= 1)
                return 0;
            if (n == 2)
                return 1;
            else
                return n * (n - 1) / 2;
            #endregion
        }
    }
}

Measured memory_bytes: 11220
n, y = map(int,input().split())
flag=False
for i in range(y//10000, -1, -1):
    for j in range((y-i*10000)//5000, -1, -1):
        k=(y-i*10000-j*5000)/1000
        if i+j+k==n:
            print(str(i)+" "+str(j)+" "+str(int(k)))
            flag=True
            break
    if flag==True:
        break
if flag==False:
    print("-1 -1 -1")

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

typedef long long ll;
typedef pair<ll, ll> P;

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

const ll MAX = 55;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int N, p[MAX];

int main(){
    cin >> N;
    rep(i, N) cin >> p[i];

    bool flg = true;
    rep(i, N - 1){
        if(p[i] > p[i+1]){
            flg = false;
        }
    }

    if(flg){
        cout << "YES" << endl;
        return 0;
    }

    rep(i, N)rep(j,i){
        swap(p[j], p[i]);
        flg = true;
        rep(k, N - 1){
            if(p[k] > p[k+1]){
                flg = false;
                break;
            }
        }
        if(flg){
            cout << "YES" << endl;
            return 0;
        }
        swap(p[j], p[i]);
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
  
int main(void){
  
char num[1001];
  
int i=0;
  
int sum=1;
  
while(sum!=0){
  
sum=0;
  
i=0;
  
scanf("%c",&num[i]);
  
while(num[i]!='\n'){
  
i++;
  
scanf("%c",&num[i]);
  
}
  
num[i]='\0';
  
i=0;
  
while(num[i]!='\0'){
  
sum+=num[i]-'0';
  
i++;
  
}
  
if(sum!=0){
  
printf("%d\n",sum);
  
}
  
}
  
return 0;
  
}

Measured memory_bytes: 536
n = int(input())
G = [[] for i in range(n)]
root = 0
color_num = 0

for i in range(n - 1):
  a, b = map(int, input().split())
  G[a - 1].append((b - 1, i))
  G[b - 1].append((a - 1, i))
  if color_num < len(G[a - 1]):
    root = a - 1
    color_num = len(G[a - 1])
  elif color_num < len(G[b - 1]):
    root = b - 1
    color_num = len(G[b - 1])

# print(G)
# [[1], [0, 2, 3, 4], [1], [1, 6], [1, 5], [4, 7], [3], [5]]
# print(root) # 最も多い色を持つノードの番号
print(color_num)  # 必要な最小色数
queue = [(root, -1)]
checked = set()
answer = [-1] * (n - 1)

while len(queue) > 0:
  node, c = queue.pop(0)
  color = 1
  for node2, index in G[node]:
    if node2 not in checked:
      if color == c:
        color = c + 1
      answer[index] = color
      color += 1
      queue.append((node2, answer[index]))
  checked.add(node)
print('\n'.join(map(str, answer)))


Measured memory_bytes: 49152
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

using namespace std;
using Int = long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rer(i,l,r) for(int(i)=(l); (i)<(r); ++(i))
#define rep(i,n) rer(i,0,n)
#define gnr(i,l,r) for(int (i)=(r)-1; (i)>=(l); --(i))
#define pri(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<(p).fi<<' '<<(p).se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  cin>>s; int ans=0;
  rep(i,6)ans+=s[i]-'0';
  END
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int N, A, B;
    cin >> N >> A >> B;

    cout << min(N * A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int pay = 1;
		
		List<Integer> cntArray = new ArrayList<>();
		
		while(pay != 0) {
			pay = sc.nextInt();
			
			if(pay == 0) {
				break;
			}
			
			int change = 1000 - pay;
			int cnt = 0;
			
			while(change > 0) {
				if(change >= 500) {
					change-=500;
					cnt++;
				} else if(change >= 100) {
					change-=100;
					cnt++;
				} else if(change >= 50) {
					change-=50;
					cnt++;
				} else if(change >= 10) {
					change-=10;
					cnt++;
				} else if(change >= 5) {
					change-=5;
					cnt++;
				} else if(change >= 1) {
					change-=1;
					cnt++;
				}
			}
			
			cntArray.add(cnt);
		}
		
		for(int i = 0; i < cntArray.size(); i++) {
			System.out.println(cntArray.get(i));
		}
	}
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M);
    for (int i = 0; i < M; i++) {
        cin >> L[i] >> R[i];
        L[i]--;
        R[i]--;
    }
    vector<int> sum(N + 1, 0);
    for (int i = 0; i < M; i++) {
        sum[L[i]]++;
        sum[R[i] + 1]--;
    }
    for (int i = 1; i < N + 1; i++) {
        sum[i] += sum[i - 1];
    }
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (sum[i] == M) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int n,m,a[55],ans;
bool cmd(int a,int b)
{
	return a>b;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",strout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1,cmd);
	for(int i=1;i<=m;i++)
	{
		ans+=a[i];
	}
	cout<<ans;

	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()

DP = [[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            DP[i+1][j+1] = max(DP[i][j]+1,DP[i+1][j],DP[i][j+1])
        else:
            DP[i+1][j+1] = max(DP[i+1][j],DP[i][j+1])

i = len(s)
j = len(t)
ans = []
while i>0 and j>0:
    if DP[i][j] == DP[i-1][j]:
        i-=1
    elif DP[i][j] == DP[i][j-1]:
        j-=1
    else:
        i-=1
        j-=1
        ans.append(s[i])


print("".join(ans[::-1]))

Measured memory_bytes: 113372
fun main(args: Array<String>)
{
  val (n,k) = readLine()!!.split(" ").map(String::toInt)
  var a:MutableList<Int> = readLine()!!.split(" ").map(String::toInt).toMutableList()
  val ans = mutableListOf<Int>()
  var ok=true
  var now = -1
  var size=0
  for(i in 0..k)
  {
    var pos= -1
    var mi =1e9.toInt()
    for(j in 0..n-1)
      if(j!=now&& a[j]<=mi)
      {
        pos=j
        mi=a[j]
      }
    for(j in 0..n-1)
      if(j!=now&& j!=pos)
      {
        ans.add(j+1)
        size++
        a[j]--
        if(a[j]<0)
          ok=false
      }
    ans.add(pos+1)
        size++
    a[pos]--
    if(a[pos]<0)
      ok=false
    now= pos
  }
  if(ok)
  {
    println(size)
    for(i in 0..size-1)
    {
      print(ans[i])
      if(i!=size-1)
        print(" ")
      else println("")
    }
  }
  else
    println(-1)
}


Measured memory_bytes: 38064
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  ll N,A,B,ans; cin>>N>>A>>B;
  cout<<N/(A+B)*A+min(N%(A+B),A)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int d, n;
	cin >> d >> n;
	int bs = 1;
	while( d ){
		bs = bs*100;
		d--;
	}
	
	if( n == 100 ){
		bs = bs*101;
	}else{
		bs = bs*n;
	}

	cout << bs << endl;
	return 0;
}

Measured memory_bytes: 3644
# 解説AC
import sys
input = sys.stdin.buffer.readline

n = int(input())
A = list(map(int, input().split()))
B = []
for i, e in enumerate(A):
    B.append((e, i + 1))
B.sort(reverse=True)
# dp[i][j]: Aiまで入れた時、左にj個決めた時の最大値
dp = [[-1] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for j in range(i + 1):  # 左の個数
        k = i - j  # 右の個数
        ni = i + 1
        val, idx = B[i]
        dp[ni][j] = max(dp[ni][j], dp[i][j] + abs(n - k - idx) * val)
        dp[ni][j + 1] = max(dp[ni][j + 1], dp[i][j] + abs(idx - (j + 1)) * val)
ans = 0
for i in range(n + 1):
    ans = max(ans, dp[n][i])
print(ans)


Measured memory_bytes: 100152
#include<iostream>
#include<vector>
#include<string>

using namespace std; 

int main(){
  int n;
  vector<int> K(100);
  string s;
  string c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

  while(1){
    int l=0;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++) cin>>K[i];
    for(int j=n;j<100;j++){
      int count=0;
      if(count==n)l=count=0;
      K[j]=K[l];
      l++;
      count++;
    }
    cin>>s;
    for(int i=0;i<s.size();i++){
      for(int j=0;j<c.size();j++){
	if(s[i]==c[j]){
	  if(j-K[i]<0){
	    s[i]=c[c.size()+j-K[i]];
	    break;
	  }else{
	    s[i]=c[j-K[i]];
	    break;
	  }
	}
      }
    }
    cout<<s<<endl;
    s.clear();
    K.clear();
  }
  
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll a;
	cin>>a;
	a = a % 1000;
	cout<<(1000 - a) % 1000<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << max({a*c,a*d,b*c,b*d}) << "\n";



  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdint>
#include<algorithm>

int const MAXN = 16;

int N;
int64_t a[MAXN][MAXN];

int64_t dp[1<<MAXN];
int64_t tb[1<<MAXN];

void init() {
  for(int i = 0; i < (1<<N); ++i) tb[i] = 0;
  for(int i = 0; i < N; ++i) for(int j = i+1; j < N; ++j) {
    int x = (1<<i) + (1<<j);
    for(int k = 0; k < (1<<N); ++k) if((x&k)==x) tb[k] += a[i][j];
  }
}

int64_t calc(int bits) {
  if(dp[bits] >= 0) return dp[bits];
  int64_t ret = tb[bits];
  int i = bits-1;
  while(i > 0) {
    int j = bits - i;
    if(i < j) ret = std::max(ret, calc(i)+calc(j));
    --i;
    i&=bits;
  }
  return dp[bits] = ret;
}

int main() {
  std::cin >> N;
  for(int i = 0; i < N; ++i) for(int j = 0; j < N; ++j) std::cin >> a[i][j];
  for(int i = 0; i < (1<<N); ++i) dp[i] = -1;
  init();
  std::cout << calc((1<<N)-1) << std::endl;
  return 0;
}


Measured memory_bytes: 1280
import collections
s = []
def main():
  n = int(input())
  for i in range(n):
    s.append(input())
  col = collections.Counter(s)
  for i in ['AC','WA','TLE','RE']:
    print(i,'x',col[i])
    
    
if __name__ == '__main__':
  main()

Measured memory_bytes: 16612
#include <bits/stdc++.h>
void definitions(){
#define ll long long
#define vec vector
#define dl double
#define pi pair  < int , int >
#define pl pair < ll , ll >
#define files_mode freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define fl float
#define PAIR make_pair#000000
#define INF 1e9
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}
using namespace std;
/******************* This Code was written by : Omar Al-Jarrah ********************/
int n , arr[(int)1e5 + 1] , dp[(int)1e5 + 1];
int solve(int i){
    if (i == n - 1) return 0;
    if (i >= n) return 1e9;
    if (dp[i] != -1) return dp[i];
    int dp1 = solve(i + 1) + abs(arr[i] - arr[i + 1]);
    int dp2 = solve(i + 2) + abs(arr[i] - arr[i + 2]);
    return dp[i] = min(dp1 , dp2);
}

int main() {definitions();fastIO
    cin >> n;
    for (int  i = 0 ; i < n ; i ++) cin >> arr[i];
    memset(dp , -1 , sizeof dp);
    cout << solve(0) << endl;
return 0;}


Measured memory_bytes: 10680
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
typedef long long ll;

bool check(int start, string s, string t) {
    for(int i = start; i - start < t.size(); i++) {
        if(s[i] == t[i - start] || s[i] == '?')
            ;
        else
            return false;
    }
    return true;
}

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    for(int i = n - m; i >= 0; i--) {
        if(check(i, s, t)) {
            vector<char> res(n);
            for(int j = 0; j < n; j++) {
                if(i <= j && j < i + m) {
                    res[j] = t[j - i];
                } else {
                    if(s[j] == '?')
                        res[j] = 'a';
                    else
                        res[j] = s[j];
                }
                cout << res[j];
            }
            cout << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
    return 0;
}

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

int main(){
  ll n,k;
  cin>>n>>k;
  if (n<=k){
    ll a = abs(n-k);
    ll b = n;
    cout << min(a,b) << endl;
    return 0;
  }
  else {
    if (n%k == 0){
      cout << 0 << endl;
      return 0;
    }
    else {
      ll a = n%k;
      ll b = abs(n%k - k);
      cout << min(a,b) << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int i,j;
  int n;
  cin>>n;
  set<string> se;
  for(i=0;i<n;i++){
    string s;
    cin>>s;
    se.insert(s);
  }
  cout<<se.size()<<endl;

}

Measured memory_bytes: 19244
import java.io.*;
import java.util.StringTokenizer;

class Index {
	String str;
	int num = 1;
	int length;

	Index(String s) {
		this.str = s;
		this.length = s.length();
	}

	void add() {
		this.num++;
	}

	boolean check(String s) {
		if (this.str.equals(s)) return true;
		else return false;
	}
}

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String buf = br.readLine();
			Index i[] = new Index[1000];
			StringTokenizer st = new StringTokenizer(buf);
			int c = 0;
			boolean isNotAdded = true;

			while (st.hasMoreTokens()) {
				String s = st.nextToken();
				for (int j=0;j<c;j++) {
					if (i[j].check(s)) {
						i[j].add();
						isNotAdded = false;
					}
				}
				if (isNotAdded) i[c++] = new Index(s);
				isNotAdded = true;
			}
			int mfw = 0;
			int mlw = 0;
			for (int j=0;j<c;j++) {
				if (i[j].num>mfw) mfw = i[j].num;
				if (i[j].length>mlw) mlw = i[j].length;
			}
			String MFW = "";
			String MLW = "";
			for (int j=0;j<c;j++) {
				if (mfw==i[j].num) MFW = i[j].str;
				if (mlw==i[j].length) MLW = i[j].str;
			}
			System.out.println(MFW+" "+MLW);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16876
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    int64_t N, T;
    cin >> N >> T;
    vector<int64_t> t(N);
    for(int i=0; i<N; i++) {
        cin >> t[i];
    }

    int64_t ans = 0;
    int64_t last = 0;
    for(int i=0; i<N; i++) {
        ans += min(t[i]+T - last, T);
        last = t[i] + T;
    }

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


Measured memory_bytes: 1792
def main():
    h, w, m = list(map(int, input().split(" ")))
    x_hi = [0 for _ in range(h)]
    x_wi = [0 for _ in range(w)]

    bom_set = set([])
    for _ in range(m):
        hi, wi = list(map(int, input().split(" ")))
        hi-=1
        wi-=1
        x_hi[hi]+=1
        x_wi[wi]+=1
        bom_set.add((hi, wi))

    #obj_num_max_h = max(x_hi)
    #obj_num_max_w = max(x_wi)
    #print(obj_num_max_h, obj_num_max_w)
    #print(x_hi, x_wi)

    obj_num_max_h = 0
    ind_num_max_h = []
    for i, x in enumerate(x_hi):
        if obj_num_max_h<x:
            obj_num_max_h = x
            ind_num_max_h = [i]
        elif obj_num_max_h==x:
            ind_num_max_h.append(i)

    obj_num_max_w = 0
    ind_num_max_w = []
    for i, x in enumerate(x_wi):
        if obj_num_max_w<x:
            obj_num_max_w = x
            ind_num_max_w = [i]
        elif obj_num_max_w==x:
            ind_num_max_w.append(i)       

    for ih in ind_num_max_h:
        for iw in ind_num_max_w:
            if (ih, iw) in bom_set:
                continue
            else:
                print(obj_num_max_h + obj_num_max_w)
                exit()
    print(obj_num_max_h + obj_num_max_w - 1)

if __name__=="__main__":
    main()


Measured memory_bytes: 83512
import math

n = int(input())
mod = 10 ** 9 + 7

ab = {}
for i in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        pass
    elif a == 0:
        b = 1
    else:
        gcd = math.gcd(a, b)
        a //= gcd
        b //= gcd
        if a < 0:
            a, b = -a, -b
    num = (a, b)
    ab.setdefault(num, 0)
    ab[num] += 1
ans = 0
if (0, 0) in ab.keys():
    temp2 = ab[(0, 0)]
    ans += temp2
    n -= temp2
s = set(ab.keys())
pairs = []
for i in ab.keys():
    if i == (0, 0):
        continue
    else:
        a, b = i[0], i[1]
        if (-b, a) in s:
            pairs.append([ab[(a, b)], ab[(-b, a)]])
temp3 = 1
for i in range(len(pairs)):
    num2 = pairs[i][0]
    num3 = pairs[i][1]
    temp3 *= (pow(2, num2, mod) + pow(2, num3, mod) - 1)
    n = n- num2 - num3
    temp3 %= mod
temp3 *= pow(2, n, mod)
temp3 -= 1
temp3 %= mod
ans += temp3
ans %= mod
print(ans)

Measured memory_bytes: 59592
#include <iostream>
#include <algorithm>
using ll = long long;
using namespace std;
int main() {
  int n; cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a+n);
  cout << a[n-1] - a[0];
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,ans=100000;
  cin >> n;
  for(int i=0;i<n;i++){
    ans *= 1.05;
    if(ans%1000!=0) ans += (1000-ans%1000);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1160
n,x =map(int,input().split())
a = list(map(int,input().split()))
a.append(x)
a.sort()
b = []
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
for i in range(n):
  b.append(a[i+1]-a[i])
print(gcd_list(b))

Measured memory_bytes: 15020
from itertools import permutations

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

iP, iQ = None, None
for idx, perm in enumerate(permutations(range(1, N + 1))):
    if perm == P:
        iP = idx
    if perm == Q:
        iQ = idx
print(abs(iP - iQ))

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

int main(){
    int N;
    string ans = "No";
    cin >> N;
    for (int i = 1; i < 10; i++){
        for (int j = 1; j < 10; j++){
            if (i * j == N){
                ans = "Yes";
                break;
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
import sys

#コインの枚数と合計金額を入力
num_coins_500 = int(input())
num_coins_100 = int(input())
num_coins_50 = int(input())
total = int(input())

#確認
if not 0<=num_coins_50<=50 or not 0<=num_coins_100<=50 or not 0<=num_coins_500<=50 or not 50<=total<=20000:
    sys.exit()

#フラグ設定
flag = 0

#全探索
for i in range(0, num_coins_50+1, 1):
    for j in range(0, num_coins_100+1, 1):
        for k in range(0, num_coins_500+1, 1):
            
            #合計金額（total）と等しくなったらカウント
            if total ==  50*i + 100*j + 500*k:
                    
                flag += 1
                    
print(flag)

Measured memory_bytes: 3064
N = int(input())
s = list(input())
rev = {"S":"W","W":"S"}

ok = False
for x,y in [("S","S"),("S","W"),("W","S"),("W","W")]:
    ans = [x,y]+["a"]*(N-2)

    for i in range(1,N-1):
        if ans[i]=="S" and s[i]=="o":
            ans[i+1]=ans[i-1]
        elif ans[i]=="S" and s[i]=="x":
            ans[i+1]=rev[ans[i-1]]
        elif ans[i]=="W" and s[i]=="o":
            ans[i+1]=rev[ans[i-1]]
        elif ans[i]=="W" and s[i]=="x":
            ans[i+1]=ans[i-1]

    if ans[N-1]==ans[1] and ((s[0]=="o" and ans[0]=="S") or (s[0]=="x" and ans[0]=="W")):
        ok = True
    if ans[N-1]!=ans[1] and ((s[0]=="x" and ans[0]=="S") or (s[0]=="o" and ans[0]=="W")):
        ok = True

    if not ok:
        continue
    
    ok=False
    if ans[N-2]==ans[0] and ((s[N-1]=="o" and ans[N-1]=="S") or (s[N-1]=="x" and ans[N-1]=="W")):
        ok = True
    if ans[N-2]!=ans[0] and ((s[N-1]=="x" and ans[N-1]=="S") or (s[N-1]=="o" and ans[N-1]=="W")):
        ok = True

    if ok:
        break

if ok:
    print("".join(ans))
else:
    print(-1)
            

Measured memory_bytes: 83512
#include <bits/stdc++.h>
using namespace std;
void solve(int n,int m,int t){
    vector<bool> tl(t,true);
    int in,ans=0;
    for(int i=0;i<n;i++){
        cin>>in;
        in-=1;
        for(int j=max(0,in-m+1);j<min(t,in+m+1);j++){
            tl[j]=false;
        }
    }
    for(int i=0;i<t;i++){
        if(tl[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
}


int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    solve(a,b,c);
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

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

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


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

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

if(s.size()<=k){cout<<s<<endl;
return 0;}

string ans="";
for(int i=0;i<k;i++){
	ans+=s[i];
}
ans+="...";
cout<<ans<<endl;
return 0;

}




Measured memory_bytes: 3628
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

ll l1_dist(ll a, ll b, ll c, ll d) {
    return abs(a - c) + abs(b - d);
}

void solve() {
    ini(N, M);
    vll a(N), b(N);
    rep(i, N) cin >> a[i] >> b[i];
    vll c(M), d(M);
    rep(i, M) cin >> c[i] >> d[i];

    rep(i, N) {
        ll ret = -1;
        ll min_dist = 1LL << 62; 
        rep(j, M) {
            ll dist = l1_dist(a[i], b[i], c[j], d[j]);
            if (min_dist > dist) {
                 min_dist = dist;
                 ret = j;
            }
        }
        out(ret + 1);
    }
}


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

const int N = 3005;
const int MOD = 1e9 + 7;

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

int solve(int kiri, int kanan) {
  if (kiri == 0 && kanan == 0) return 1;
  if (kiri < 0 || kanan < 0) return 0;

  int &ret = dp[kiri][kanan];
  if (ret != -1) return ret;
  
  int pos = n - kiri - kanan - 1;
  if (s[pos] == '<') {
    ret = solve(kiri-1, kanan);
    ret = (ret + solve(kiri-1, kanan+1)) % MOD; 
  } else {
    ret = solve(kiri, kanan-1);
    ret = (ret + solve(kiri+1, kanan-1)) % MOD;
  }

  return ret;
}

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

  memset(dp, -1, sizeof dp);
  int ret = 0;
  for (int i = 1 ; i <= n ; i++) {
    ret = (ret + solve(i-1, n-i)) % MOD;
  }

  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 35712
#include<stdio.h>

int main()
{
  int N;
  int ans;
  
  scanf("%d",&N);
  
  ans = N / 1.08;
    
  if((ans*1.08 < N)&&((ans + 1)*1.08 >= (N + 1))){
    printf(":(");
  }
  else if((ans * 1.08 < N)&&((ans + 1) * 1.08 < N + 1)){
    printf("%d",ans + 1);
  }
  else if((ans * 1.08 > N)&&((ans - 1) * 1.08 > N)){
    printf("%d",ans - 1);
  }
  else{
    printf("%d",ans);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int x=min(a,b);
    bool tgs=true;
    for(int i=2;i<=x;i++){
        if(a%i==0&&b%i==0)tgs=false;
    }
    if(tgs==true)puts("YES");
    else{
        bool bo=false;
        int newa=a;
        for(int i=0;i<b;i++){
            if(newa%b==c)bo=true;
            newa+=a;
        }
        if(bo==true)puts("YES");
        else puts("NO");
    }
    return 0;
}

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

typedef long long lint;
typedef long double ldouble;
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = 1e18;
const lint MOD = 1e9 + 7;
const lint inv = MOD - 2;

struct island{
    lint value, allow;
};

bool compare(island a, island b){
    return a.allow < b.allow;
}

bool solve(int n){
    vector<island> v(n);
    rep(i, n){
        cin >> v[i].value >> v[i].allow;
    }
    sort(v.begin(), v.end(), compare);
    int now = 0;
    rep(i, n){
        now += v[i].value;
        if(now > v[i].allow){
            return false;
        }
    }
    return true;
}

int main(){
    int n;
    while(cin >> n && n){
        if(solve(n)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3096