akhauriyash/Code-Regression huggingface dataset:
K=int(input())
tmp=0
i=0
k=0
res=1
def S(a):
  res=0
  while(a!=0):
    res+=a%10
    a//=10
  return res
def check(i,a):
  if (10**i)*S(a)<a:
    return True
  return False
while(True):
  if k==K:
    break
  print(res)
  k+=1
  res+=10**i
  if check(i,res):
    res-=10**i
    i+=1
    res+=10**i


Measured memory_bytes: 38640
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [a, b, c, d] = input.trim().split(" ").map(Number);

  const left = a + b;
  const right = c + d;
  let ans = left > right ? "Left" : left === right ? "Balanced" : "Right";
  console.log(ans);
}


Measured memory_bytes: 7372
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	int Q;
	long r,l;
	public void solve() {
		Q = nextInt();
		r = 0;
		l = 0;
		for(int i = 0;i < Q;i++){
			long p = nextLong();
			String c = next();
			long n = nextLong();
			
			if(c.equals("(")){
				r += n;
			}else{
				l += n;
			}
			
			if(r == l){
				out.println("Yes");
			}else{
				out.println("No");
			}
		}
	}
 
	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}
		/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 33644
#include<stdio.h>

int main(void){
  int x,n,i;

  scanf("%d", &n);
 
  for(x=1;x<=n;x++){
  if ( x % 3 == 0 ){
    printf(" %d",x);
  }else {
      i=x;
      while(1){
         if(i==0) break;
         if(i%10==3) {
             printf(" %d",x);
            break;  
         }
         i/=10; 
      }
  }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2100
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 8010
bool dp[2][2][N*2+100];

int main(){
	string s;
	ll a[2];
	cin>>s>>a[0]>>a[1];
	ll bb = 0;
	vector<int> b[2];
	int n = s.size();
	bool first = true;
	int t = 0;
	rep(i, n){
		if(s[i]=='T'){
			first = false;
			t = !t;
			b[t].push_back(0);
		} else {
			if(first) bb++;
			else b[t].back()++;
		}
	}
	cerr<<"A"<<endl;
	rep(i, 2){
		cerr<<b[i]<<endl;
	}
	/*rep(i, 2){
		sort(all(b[i]));
		reverse(all(b[i]));
	}*/
	dp[0][0][N+bb] = 1;
	dp[1][0][N] = 1;
	bool ok = true;
	rep(i, 2){
		cerr<<"C"<<endl;
		int s = 0;
		for(auto z: b[i]){
			//cerr<<i<<" "<<!s<<" "<<" "<<z<<endl;
			//rep(j, N*2) dp[i][!s][j] = 0;
			memset(dp[i][!s], 0, sizeof(bool)*(2*N+10));
			//cerr<<"B"<<endl;
			rep(j, N*2){
				if(dp[i][s][j]){
					//cerr<<j<<" "<<z<<endl;
					dp[i][!s][j+z] = 1;
					dp[i][!s][j-z] = 1;
				}
			}
			s = !s;
		}
		if(!dp[i][s][N+a[i]]) ok = false;
	}
	cout<<(ok?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
using namespace std;
int main(void)
{
	int n;
	int a[4];
	char ch[10];
	char str[4][10]={{"AC"},{"WA"},{"TLE"},{"RE"}};
	while(~scanf("%d",&n))
	{
		memset(a,0,sizeof(a));
		getchar();
		for(int i=0;i<n;++i)
		{
			scanf("%s",ch);
			for(int j=0;j<4;++j)
			{
				if(strcmp(ch,str[j])==0)
				a[j]++;
			}
		}
		for(int i=0;i<4;++i)
			printf("%s x %d\n",str[i],a[i]);
	}
	
	return 0;
}

Measured memory_bytes: 3216
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static bool judge(long n)
        {
            var keta =new List<long>();
            long tmp = n;
            while (tmp > 0)
            {
                keta.Add(tmp % 10);
                tmp /= 10;
            }
            var sum = keta.Sum();
            if (n % sum == 0)
                return true;
            else
                return false;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();

            if (judge(n))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");


            
           
            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13268
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

  static class ABA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int a = in.readInt(), b = in.readInt();
      if (b % a == 0) out.printLine(a + b);
      else out.printLine(b - a);
    }
  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(int i) {
      writer.println(i);
    }
  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int readInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}


Measured memory_bytes: 21460
// In The Name Of God
#include <bits/stdc++.h>

#define sqr(A) ((A) * (A))
#define F first
#define S second
#define MP make_pair
#define BSZ  __builtin_popcount
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int MOD2 = 1e9 + 9;
const int PR = 727;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

int a, b;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if (a * b == 15)
		return cout << "*" << endl, 0;
	if (a + b == 15)
		return cout << "+" << endl, 0;
	cout << "x" << endl;
}


Measured memory_bytes: 256
//2019.5.9 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-10
#define RG register
inline int read() {
    res s=0,ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return s;
}
inline LL Read() {
    RG LL s=0;
    res ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return s;
}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
const int N=1e3+10;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
namespace MAIN {
    char str[N];
    int n,m;
    int dis[N][N];
    typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
    Pair Q[N*N];
    int he=1,ta;
    int ans;
    inline void MAIN(){
        n=read(),m=read();
        for(res i=1;i<=n;i++){
            scanf("%s",str+1);
            for(res j=1;j<=m;j++){
                dis[i][j]=-1;
                if(str[j]=='#')Q[++ta]=mp(i,j),dis[i][j]=0;
            }
        }
        while(he<=ta){
            RG Pair u=Q[he++];
            for(res i=0;i<=3;i++){
                res tx=u.fi+dx[i],ty=u.se+dy[i];
                if(tx<1||ty<1||tx>n||ty>m||~dis[tx][ty])continue;
                dis[tx][ty]=dis[u.fi][u.se]+1,Q[++ta]=mp(tx,ty),ans=max(ans,dis[tx][ty]);
            }
        }
        printf("%d\n",ans);
    }
}
int main() {
//    srand((unsigned)time(NULL));
//    freopen("graph.in","r",stdin);
//    freopen("graph.out","w",stdout);
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string s;
  cin>>s;
  int z=0,o=0;
  for(auto x:s){
    if(x=='0')z++;
    else o++;
  }
  cout<<2*(z>o?o:z)<<endl;
  return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

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

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

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

	int m[10010];

	int m_min = mod;
	REP(i, N) {
		cin >> m[i];
		X -= m[i];
		m_min = min(m_min, m[i]);
	}
	int ans = N;
	ans += (X / m_min);
	cout << ans;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define ll long long

using namespace std;



const ll mod = 1000000007;
ll dp[1005][1005];
char matrix[1005][1005];
int n, m;

ll dfs(int i, int j)
{
	if(dp[i][j] >= 0)
		return dp[i][j];

	dp[i][j] = 0;
	if(i == n - 1 && j == m - 1)
	{
		return dp[i][j] = 1;
	}

	if(i < n - 1 && matrix[i+1][j] == '.')
	{
		dp[i][j] += dfs(i + 1, j);
		dp[i][j] = dp[i][j] % mod;
	}

	if(j < m - 1 && matrix[i][j+1] == '.')
	{
		dp[i][j] += dfs(i, j + 1);
		dp[i][j] = dp[i][j] % mod;
	}


	return dp[i][j];

}





int main()
{

	cin >> n >> m;


 	memset(dp, -1, sizeof(dp));
 
 	int num1, num2;
 	for (int i = 0; i < n; ++i)
 	{
 		for (int j = 0; j < m; ++j)
 		{
 			cin >> matrix[i][j];
 		}
 	}
 	
 	cout << dfs(0, 0) << endl;


 
    return 0;
}

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

class Program {
	static void Main(string[] args) {
		new Calc().calc();
	}
	public class Calc {
		public Calc() { }
		public void calc() {
			long x = ReadLine<long>();
			var count = x / 11 * 2;
			x = x - (count/2 * 11);
			var sub = 6;
			while (x>0) {
				x -= sub;
				sub = sub == 6 ? 5 : 6;
				count++;
			}
			count.WriteLine();
			
			return;
		}
	}

	public static T ReadLine<T>() {
		return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));
	}

	public static T[] ReadLine<T>(params char[] separators) {
		return Console.ReadLine()
			.Split(separators)
			.Select(_ => (T)Convert.ChangeType(_, typeof(T)))
			.ToArray();
	}

	public static List<T> ReadLines<T>(int readCount) {
		List<T> rt = new List<T>();
		for (int i = 0; i < readCount; i++) {
			rt.Add(ReadLine<T>());
		}
		return rt;
	}
}
public static class Utils {
	public static string Docking<T>(this IEnumerable<T> s, int sequenceRange, Func<T, string> filter = null) {
		string str = "";
		int c = 0;
		foreach (var item in s) {
			str += filter == null ? item.ToString() : filter(item);
			c++;
			if (c == sequenceRange) break;
		}
		return str;
	}

	public static string Docking<T>(this IEnumerable<T> s, Func<T, string> filter = null) {
		return s.Docking(s.Count(), filter);
	}

	public static string RangeDocking<T>(this IEnumerable<T> s, int start, int end, Func<T, string> filter = null) {
		string str = "";
		end = end < s.Count() ? end : s.Count();
		var items = s.ToArray();
		for (int i = start; i < end; i++) {
			str += filter == null ? items[i].ToString() : filter(items[i]);
		}
		return str;
	}
	public static int IntParse(this string n) {
		return int.Parse(n);
	}
	public static void WriteLine<T>(this IEnumerable<T> list) {
		foreach (var item in list) {
			item.WriteLine();
		}
	}
	public static void WriteLine(this object obj) {
		Console.WriteLine(obj);
	}
	public static void AddTo<T>(this T obj,List<T> list) {
		list.Add(obj);
	}
}

Measured memory_bytes: 13140
while True:
  try:
    m,n = map(int, input().split())
  except EOFError:
    break
  LCM = m * n
  if m < n:
    m,n = n,m

  # calculating GCD
  while True:
    if m % n == 0:
      GCD = n
      break
    else:
      m, n = n, m % n

  # calculating LCM
  LCM = LCM // GCD

  print(GCD,LCM)


Measured memory_bytes: 5592
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
V = LIST()
C = LIST()

ma = 0
for i in range(N):
	if V[i] > C[i]:
		ma += V[i] - C[i]

print(ma)

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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            //ここから

            var N = IO.ReadLineToInt();
            var d = IO.ReadLineToIntArray();

            var sum = 0;

            for(int i = 0; i < N; i++)
            {
                for(int j = i+1; j < N ; j++)
                {
                    sum += d[i] * d[j];
                }
            }
            

            //ここまで
            Console.WriteLine(sum);
            Console.ReadKey();
        }
    }

    static class Func
    {
        static long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }
        static public int Conbin(int n, int m) { return Factorial(n) / (Factorial(n - m) * Factorial(m)); }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < (long)Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray() { return Console.ReadLine().Split(' ').ToArray(); }
        static public int[] ReadLineToIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
}

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

int main() {
  int n;
  cin >> n;
  if(400<=n && n<=599) cout << 8 << endl;
  else if(600<=n && n<=799) cout << 7 << endl;
  else if(800<=n && n<=999) cout << 6 << endl;
  else if(1000<=n && n<=1199) cout << 5 << endl;
  else if(1200<=n && n<=1399) cout << 4 << endl;
  else if(1400<=n && n<=1599) cout << 3 << endl;
  else if(1600<=n && n<=1799) cout << 2 << endl;
  else if(1800<=n && n<=1999) cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;
int a[N], n;
bool vis[N];
ll k;
int main() {
    scanf("%d%lld", &n, &k), k++;
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    int pos = 1;
    vector<int> vec;
    while(!vis[pos]) {
        vec.push_back(pos);
        vis[pos] = true;
        pos = a[pos];
    }
    if(k <= vec.size()) {
        printf("%d\n", vec[k - 1]);
    }else {
        int t = a[vec[vec.size() - 1]], x;
        for(int i = 0; i < vec.size(); i++) {
            if(vec[i] == t) {
                x = vec.size() - i;
                break;
            }
            k--;
        }
        k %= x;
        t = vec[vec.size() - 1];
        while(k--) {
            t = a[t];
        }
        printf("%d\n", t);
    }
    return 0;
}

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

const int N = 200005;

int n, k, cnt[N];
vector<int> a;
int ans;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		int x; cin >> x;
		cnt[x]++;
	}
	for (int i = 1; i <= n; ++i) if (cnt[i]) a.push_back(cnt[i]);
	sort(a.begin(), a.end(), greater<int>());
	if (a.size() <= k) {
		return printf("0\n"), 0;
	}
	while(a.size() > k) {
		int cur = a.back(); a.pop_back();
		ans += cur;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2168
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    string s, t;
    cin>>s>>t;
    if(s.size()==t.size()){
        REP(i, s.size()){
            cout << s[i] << t[i];
        }
        cout << endl;
    } else {
        REP(i, t.size()){
            cout << s[i] << t[i];
        }
        cout << s[s.size()-1] << endl;
    }
    return 0;
}

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

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

    ll ans = 0;
    for (int i = 1; i <= K; ++i) {
        for (int j = 1; j <= K; ++j) {
            for (int k = 1; k <= K; ++k) {
                int tmp = gcd(i, j);
                tmp = gcd(tmp, k);
                ans += tmp;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main() {
  ll n, p; cin >> n >> p;
  ll ans=1, cnt;
  if(n==1) {
    ans = p;
  }
  else {
    for(ll i = 2; i <= (ll)pow(p, (double)1/n)+1; i++) {
      cnt=0;
      while(p%i == 0) {
        p = p / i;
        cnt++;
      }
      if(cnt >= n) ans *= pow(i, (int)(cnt/n));
    }
  }
  cout << ans << endl;

  return 0;
}




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

def main():
    node_num, edge_num = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(edge_num)]

    inf = 10 ** 5 + 1
    length_data = [[inf for i in range(node_num + 1)] for j in range(node_num + 1)]

    for i in range(edge_num):
        a, b, c = data[i]
        length_data[a][b] = c
        length_data[b][a] = c

    for i in range(1, node_num + 1):
        for j in range(1, node_num + 1):
            for k in range(1, node_num + 1):
                length_data[j][k] = min(length_data[j][k], length_data[j][i] + length_data[i][k])

    ans = 0
    for i in range(edge_num):
        a, b, c = data[i]
        if c > length_data[a][b]:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40432
#include <iostream>
#include <string>

using namespace std;

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

	int ss = s.size();

	string as;
	if (ss > 3) {
		for (int i = 0; i < 4; ++i) {
			as = as + s[i];
		}
	}
	if (as == "YAKI") {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		cout << "No" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
#ABC061B

n,m=map(int,raw_input().split())
l=[]
for i in xrange(m):
 a,b=map(int,raw_input().split())
 l.append(a)
 l.append(b)
for i in xrange(1,n+1):
 cnt=l.count(i)
 print cnt


Measured memory_bytes: 2568
N = int(input())
A = map(int, input().split())

B = []
for i, a in enumerate(A):
    B.append((a, i+1))

B = sorted(B)
for i, x in enumerate(B):
    print(x[1], end = "")
    if i != len(B) - 1:
        print(" ", end = "")
    else:
        print("")


Measured memory_bytes: 23284
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int t=n;
	int sum=0;
	while(n!=0)
	{
		sum+=n%10;
		n/=10;
	}
	if(t%sum==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin >> a;
b=a;
reverse(b.begin(),b.end());
for (int i=0;i<a.length();i++){
	if (b[i]=='b') b[i]='d';
    else if (b[i]=='d') b[i]='b';
	else if (b[i]=='q') b[i]='p';
	else if (b[i]=='p') b[i]='q';
	}
if (a==b) cout << "Yes\n";
else cout << "No\n";
}

Measured memory_bytes: 512
import sys
input=sys.stdin.readline
n=int(input())
G=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=[int(v)-1 for v in input().split()]
    c+=1
    G[a].append((b,c))
    G[b].append((a,c))
q,k=[int(v) for v in input().split()]
k=k-1
stack=[k]
dis=[-1]*n
dis[k]=0
while stack!=[]:
    now=stack.pop()
    d=dis[now]
    for i in G[now]:
        if dis[i[0]]==-1:
            dis[i[0]]=d+i[1]
            stack.append(i[0])
for i in range(q):
    x,y=[int(v)-1 for v in input().split()]
    print(dis[x]+dis[y])



Measured memory_bytes: 72276
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n,k;
	ll a[100001];

	cin>>n>>k;

	rep(i,n){
		cin>>a[i];
	}
	if(n==k){
		cout<<"1"<<endl;
		return 0;
	}

	n=n-1;
	if(n%(k-1)==0){
		cout<<n/(k-1)<<endl;
	}else{
		cout<<n/(k-1)+1<<endl;
	}



	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int a,b,c;
  cin>>a>>b>>c;

  cout<< ( b-a==c-b ? "YES" : "NO" )<<"\n";

}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF ll(1e18)
///#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 1000000007

int main() {
	ll n;
	cin>>n;
	ll a=n%1000;
	if (a) cout<<1000-a;
	else cout<<0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	int N;
	cin >> N;


	while (N > 0) {
		if (N % 10 == 7) {
			cout << "Yes" << endl;
			return 0;
		}
		N /= 10;
	}

	/*vector<int> v(N);
	rep(i, N) {
		cin >> v[i];
	}*/
	cout << "No" << endl;


	return 0;
}


Measured memory_bytes: 3608
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front priority_queue

#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#endif

#define endl '\n'
#define ll long long
#define rint register int
#define minpq priority_queue <int, vector<int>, greater<int> >
#define maxpq  priority_queue <int>

#define re register
#define pb(x) push_back(x);
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;
#define scan(a, n) 		for(int i = 0; i < n; i++)cin >> a[i];

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
#define infl LLONG_MAX

ll powmod(ll x, ll k) {
	ll ans = 1;
	for (; k; k >>= 1, x = (x * x) % hell)
		if (k & 1)
			ans = (ans * x) % hell;
	return ans % hell;
}

int32_t main() {
	ios::sync_with_stdio(0); 		cin.tie(0); cout.tie(0);

	ll t, i, x, j, y, 	z, k, n;
	cin >> n;

	t = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n);
	t %= hell;	t += hell;	t %= hell;

	ce(t);
}



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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int K;
int A[100010];

int main() {
	cin >> K;
	rep(i, K) cin >> A[i];

	ll lo = 2, hi = 2;

	for (int i = K-1; i >= 0; --i) {
		lo = (lo + A[i] - 1) / A[i] * A[i];
		hi = hi / A[i] * A[i] + A[i] - 1;
		if (lo > hi) {
			puts("-1");
			return 0;
		}
	}

	cout << lo << " " << hi << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
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;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
double a,b,n;
int main()
{
    //IOS;
    cin>>a>>b>>n;
    if(b>n)
    {
        cout<<floor(a*n/b)-a*floor(n/b)<<endl;
    }
    else
    {
        cout<<floor(a*(b-1)/b)-a*floor((b-1)/b)<<endl;
    }
    /*
    for(int i=0;i<=n;i++)
    {
        cout<<i<<' '<<floor(a*i/b)-a*floor(i/b)<<endl;
    }*/
    return 0;
}
/*

*/


Measured memory_bytes: 3892
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const int inf = 1e9;

pair<int,int> dp[100010];
int main() {
    int N,M;
    int cnt=0,ans=0;
    REP(i,0,100010) dp[i]={inf,-i};
    cin>>N>>M;
    REP(i,0,M){
        int a,b;
        cin>>a>>b;
        a--;b--;
        dp[a].first=min(dp[a].first,b);
    }
    sort(dp,dp+N);
    int mx=-1;
    REP(i,0,N){
        if(dp[i].first==inf) break;
        if(mx<-dp[i].second){
            mx = dp[i].first-1;
            //p(mx);
            ans++;
        }
    }
    p(ans);
    return 0;
}

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

using namespace std;

typedef long long int lli;

int d[1000], c[1000];
int n, m;

lli memo[1000][1000];

lli rec(int day, int now)
{
	if (now == n) return 0;

	if (memo[day][now] >= 0) return memo[day][now];

	lli res;

	if (m - day <= n - now) {
		res = rec(day + 1, now + 1) + d[now] * c[day];
	} else {
		res = min(rec(day + 1, now + 1) + d[now] * c[day], rec(day + 1, now));
	}

	return memo[day][now] = res;
}

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

	for (int i = 0; i < m; ++i) cin >> c[i];

	memset(memo, -1, sizeof(memo));

	printf("%lld\n", rec(0, 0));
}

Measured memory_bytes: 9016
#line 1 "template.cpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  if (a == 0) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = (n / (a + b)) * a + min(a, n % (a + b));
  cout << ans << endl;

  return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            //var n = Read<long>();
            //var s = Read();
            //var als = Read<long>(n);
            //var sls = Read(n);
            /*List<Tuple<string, long>> scls = new List<Tuple<string, long>>();
            for (int i = 0; i < m; ++i)
            {
                scls.Add(new Tuple(Read(), Read<long>()));
            }*/
            //List<List<long>> abls = new List<List<long>>();
            //List<long> cls = new List<long>();
            /*List<long> edgeNum = Enumerable.Repeat(0L, (int)n).ToList();
            for (int i = 0; i < n - 1; ++i)
            {
                abls.Add(Read<long>(2));
                abls[i].Add(i);
                abls[i].Add(-1);
                --abls[i][0];
                --abls[i][1];
                //cls.Add(Read<long>());
                ++edgeNum[(int)abls[i][0]];
                ++edgeNum[(int)abls[i][1]];
            }*/

            //als.Sort((l, r) => (int)(r - l));

            var n = Read<long>();
            var als = Read<long>(n);

            var app = als.Where(val => val % 2 == 0).All(val => val % 3 == 0 || val % 5 == 0);

            Console.WriteLine(app ? "APPROVED" : "DENIED");
        }

        static IEnumerator<string> input_iter;

        static IEnumerator<string> LazyLoadAllLines(bool doSplit = true)
        {
            string line;
            if (doSplit)
            {
                do
                {
                    line = Console.ReadLine();
                    foreach (var s in line.Split(' '))
                        yield return s;
                } while (line != null);
            }
            else
            {
                do
                {
                    line = Console.ReadLine();
                    yield return line;
                } while (line != null);
            }
        }
        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        static List<_T> Read<_T>(long num) where _T : struct
        {
            List<_T> res = new List<_T>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add((_T)Convert.ChangeType(input_iter.Current, typeof(_T)));
            }
            return res;
        }
        static List<string> Read(long num)
        {
            List<string> res = new List<string>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add(input_iter.Current);
            }
            return res;
        }

    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;

ii P[200002];

int main() {
    if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0);

    int H, W, N; cin >> H >> W >> N;
    for (int i = 0; i < N; ++i) cin >> P[i].f >> P[i].s;
    sort(P, P+N);
    for (int i = 0, c = 0; i < N; ++i) {
        if (P[i].s+c < P[i].f) {
            cout << P[i].f-1;
            return 0;
        }
        if (P[i].s+c == P[i].f) ++c;
    }
    cout << H;
    return 0;
}


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

// definitions
#define __Imperial_Lord__ ONLINE_JUDGE
#define _cps CLOCKS_PER_SEC
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#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
#define exec cerr<<"Time taken : "<<(ld)(clock())/_cps<<"s"<<endl
#define mod1 998244353
#define mod 1000000007
#define pi 3.1415926535897932384

using namespace std;

// alias name for common data types
typedef vector<long long> vl;
typedef vector<long double> vld;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll INF=1e18;

// cin and cout overloaded for vectors
template<typename T>    istream& operator>>(istream& is,  vector<T>& v)
{
    for (auto& i : v) 
        is >> i;        
    return is;
}
template<typename T>             
ostream& operator<<(ostream& os,  vector<T>& v)
{
    for (auto& i : v) 
        os << i << ' '; 
        return os;
}


// code beigns in main
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    while(t--)
    {
    	ll n;
    	cin >> n;
    	string s;
    	cin >> s;

    	ll cnt=0;
    	rep(i,0,n-2)
    	{
    		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
    			cnt++;
    	}
    	cout << cnt << endl;
    }	
    exec;
}


Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
int main(){
    int a,b,c; cin >> a >> b >> c;
    if(min(a,b) > c || max(a,b) < c){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
string s; cin >> s;
int ans = 0;
for(int i = 0; i < 6; ++i){
    if(s[i]=='1')++ans;
}
cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll size=s.size();
  
  ll r=0,g=0,b=0;
  for(int i=0; i<size; i++){
   if(s[i]=='R') r++;
   else if(s[i]=='G') g++;
   else if(s[i]=='B') b++;
  }
  ll all=r*g*b;
  
  vector<string>a(3);
  for(int i=1; i<=size; i++){
   for(int j=0; j<size-i*2; j++){
     a[0]=s[j];
     a[1]=s[j+i];
     a[2]=s[j+i*2];
     sort(a.begin(),a.end());
     if(a[0]=="B" && a[1]=="G" && a[2]=="R") all--;
   }
  }
  
  cout << all;
  
  return 0;
  
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const double tpie =2* 3.141592653589793238;


int main()
{
	double a,b,h,m;
	cin >> a >> b >> h >> m;
	h += m/60.0;
	double As = a*sin(h/12.0*tpie)
	, Ac = a*cos(h/12.0*tpie)
	, Bs = b*sin(m/60.0*tpie)
	, Bc = b*cos(m/60.0*tpie);

	double S = abs(As-Bs),C = abs(Ac-Bc);
	printf("%.20lf\n",sqrt(S*S+C*C));

}

Measured memory_bytes: 4164
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<int,int> P;
ll longinf=1ll<<60;
int inf=1<<29;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int N;
int a[200001],b[200001];


int main (){
      cin>>N;
      rep0(i,N) cin>>a[i];
      rep0(i,N) cin>>b[i];
      int ans=0;
      for(int k=29;k>=0;k--){
            ll hoge = 1ll<<(k+1);
            rep0(i,N) a[i]%=hoge;
            rep0(i,N) b[i]%=hoge;
            sort(b,b+N);
            ll T = 1ll<<k;
            ll piyo=0;
            rep0(i,N){
                  int huga =lower_bound(b,b+N,2*T-a[i])-lower_bound(b,b+N,T-a[i]);
                  int mochi =lower_bound(b,b+N,4*T-a[i])-lower_bound(b,b+N, 3*T-a[i]);
                  piyo+=(huga+mochi);
            }
            int hie=piyo%2;
            ans=2*ans+hie;
      }
      cout<<ans<<endl;

      return 0;
}


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

int main(){
  long long k, n;
  std::cin>>k>>n;
  long long arr[n];
  for(long long i=0; i<n; ++i)
    std::cin>>arr[i];

  long long l=0;
  for(long long i=0; i<(n-1); ++i){
      l=std::max(l, arr[i+1]-arr[i]);
  }
  l = std::max(l, k-(arr[n-1]-arr[0]));
  std::cout<<k-l<<std::endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<'='<<x<<' '
#define f first
#define s second
typedef long long ll;
typedef pair<int,int> pi;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	int n,m;
	cin >> n >> m;
	if(n==m) cout << "Yes";
	else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;

#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
ull gcd (ull x, ull y){return y?gcd(y,x%y):x;};
//0の時false, それ以外はtrue
//yがtrueならgcd(y,x%y) falseはx

//template<typename T>
ull lcm(ull a, ull b) {
    return a * b / gcd(a, b);
}

int main() {
  ull a,b,c,d;
  cin>>a>>b>>c>>d;
  ull c1=b/c-(a-1)/c;
  ull d1=b/d-(a-1)/d;
  ull l=lcm(c,d);
  ull l1=b/l-(a-1)/l;
  ull ans=b-a+1-c1-d1+l1;
  cout<<ans;
}


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

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

void code() {
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int ans=0;
    while(b<=a){
        b*=2;
        k-=1;
    }
    while(c<=b){
        c*=2;
        k-=1;
    }
    if(k>=0) {
        cout << "Yes\n";
    }
    else
        cout << "No\n";
}

signed main() {
    std::ios_base::sync_with_stdio(false);
    int t=1;
    // cin>>t;
    for(int i=0; i<t; i++) {
        code();
    }
}


Measured memory_bytes: 3648
#include<iostream>
#include<stdio.h>
#include<set>
using namespace std;

int N;
set<int> st;
int main (){
    cin >> N;
    for(int i=0; i<N; i++ ){
        int a;
        cin >> a;
        if(st.count(a)) st.erase(a);
        else st.insert(a);
    }
    cout << st.size() << endl;
    return 0;
}


Measured memory_bytes: 4864
#これは173_c
import sys
import itertools
input = sys.stdin.readline

H,W,K = list(map(int,input().split()))
lis_H = []
lis_W = []

for i in range(H):
    Hi = list(itertools.combinations(range(0,H),i+1))
    lis_H.append(Hi)
lis_H.append([(99,)])
for i in range(W):
    Wi = list(itertools.combinations(range(0,W),i+1))
    lis_W.append(Wi)
lis_W.append([(99,)])
C = []
for i in range(H):
    ci = input().rstrip()
    C.append(ci)
ans = 0
for hi in range(len(lis_H)):
    for hj in range(len(lis_H[hi])):
        for wi in range(len(lis_W)):
            for wj in range(len(lis_W[wi])):
                counter = 0
                for hk in range(H):
                    for wk in range(W):
                        if C[hk][wk] == '#' and ((hk not in lis_H[hi][hj]) and (wk not in lis_W[wi][wj])):
                            counter +=1
                if counter == K:
                    ans += 1


print(ans)


Measured memory_bytes: 9212