akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;

typedef pair<string, int> psi;

int main(void) {
  int n, m;

  while (cin >> n >> m) {
    if (n == 0) break;

    vector<psi> prize_lottery;
    vector<string> lottery;
    for (int i = 0; i < n; i++) {
      int tmp;
      string s;
      cin >> s >> tmp;
      prize_lottery.push_back(psi(s, tmp));
    }
    for (int i = 0; i < m; i++) {
      string s;
      cin >> s;
      lottery.push_back(s);
    }

    int sum = 0;
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < n; j++) {
	bool flag = true;
	for (int k = 0; k < 8; k++) {
	  if (prize_lottery[j].first[k] == '*') continue;
	  if (prize_lottery[j].first[k] != lottery[i][k]) {
	    flag = false;
	    break;
	  }
	}
	if (flag) {
	  sum += prize_lottery[j].second;
	  break;
	}
      }
    }

    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <stack>
#include <map>
#include <math.h>
#include <vector>
using namespace std;

int main() {

	int n;
	cin >> n;
	if(n < 1200){
		cout << "ABC";
	}else if(n >= 2800){
		cout << "AGC";
	}else{
		cout << "ARC";
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int k;
  int i,j;
  int count=0;

  while(scanf("%d",&k)==1)
    {
      for(i=2;i<=k;i+=2)
	{
	  for(j=1;j<=k;j+=2)
	    {
	     
	      count++;
	    }
	}
      printf("%d\n",count);
      count=0;
    }
  return 0;
}
  

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

int n,q,a[100010],f[100010][21],l,r;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	scanf("%d",&a[i]);
	scanf("%d",&l);
	r=1;
	for(int i=1;i<=n;++i)
	{
		while(a[r+1]-a[i]<=l&&r+1<=n)
		++r;
		f[i][0]=r;
	}
	for(int i=n;i>=1;--i)
	{
		for(int j=1;j<=20;++j)
		f[i][j]=f[f[i][j-1]][j-1];
	}
	scanf("%d",&q);
	for(int i=1;i<=q;++i)
	{
		int x,y,ans=0;
		scanf("%d%d",&x,&y);
		if(x>y)
		swap(x,y);
		for(int j=20;j>=0;--j)
		{
			if(f[x][j]<y)
			{
				x=f[x][j];
				ans+=(1<<j);
			}			
		}
		ans+=1;
		printf("%d\n",ans);
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  long a[n];
  long max = 0;
  long sum = 0;
  for(int i= 0;i < n;i++){
    cin >> a[i];
    if(max < a[i]){
      max = a[i];
    }
    sum += a[i];
  }
  if(sum > 2 * max){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        int N = cin.Nextint;
        long power = 1;
        for (int i = 1; i <= N; i++)
        {
            power = power * i % mod;
        }
        WriteLine(power);
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

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


int main(){
    long long N,ans=0;
    cin >> N;
    for(long long int i = 1;i * i <= N; ++i){
        if(N%i==0){
            if(N/i>i+1){
                ans += N/i-1;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

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

mint RepeatSquaring(mint N, ll P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    mint t = RepeatSquaring(N, P / 2);
    return t * t;
  }
  return RepeatSquaring(N, P - 1) * N;
}

mint COM(ll n, ll k) {
  mint deno = 1;
  mint mole = 1;
  for (ll i = 0; i < k; i++) {
    deno *= n - i;
    mole *= (i + 1);
  }

  // 逆元をかける = 割る
  mole = RepeatSquaring(mole, mod - 2);
  mint nCk = deno * mole;
  return nCk;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // 前処理
  // COMinit();
  mint n, a, b;
  cin >> n.x >> a.x >> b.x;

  mint ans = RepeatSquaring(2, n.x);
  ans -= 1;

  ans -= COM(n.x, a.x);
  ans -= COM(n.x, b.x);
  cout << ans.x << endl;
}

Measured memory_bytes: 256
from itertools import permutations

n,m = map(int,input().split(' '))
choices = permutations(range(1,n))
nords = [[]for _ in range(n)]
for i in range(m):
    a, b = map(lambda x : int(x)-1,input().split(" "))
    nords[a].append(b)
    nords[b].append(a)


ans = 0
for choice in choices:
    row = list(choice)
    row.insert(0,0)
    for i,nownord in enumerate(row):
        if i== n - 1 :
            ans += 1
            break
        nextnord = row[i+1]
        if not nextnord in nords[nownord]:
            break
            
            
print(ans)





Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int gcd(int x, int y);

int main(void){
	char str[257];
	char this[] = "this";
	char that[] = "that";
	char alpha[27];
	int C[10000];
	int num = 0;
	int n;
	int len;
	int i, j, k, l, m;
	int a, b;

	for(i=1; i <= 10000; i++){
		if(gcd(i, 26) == 1){
			C[num] = i;
			num++;
		}
	}

	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf(" %[^\n]%*c", str);
		len = strlen(str);

		for(j=0; j < num; j++){
			for(k=1; k <= 100; k++){
				for(l=0; l<4; l++){
					this[l] = ((C[j] * (this[l] - 97) + k) % 26) + 97;
				}
				for(l=0; l<4; l++){
					that[l] = ((C[j] * (that[l] - 97) + k) % 26) + 97;
				}

				if(strstr(str, this) != NULL || strstr(str, that) != NULL){
					strcpy(alpha, "abcdefghijklmnopqrstuvwxyz");
					for(l=0; l<26; l++){
						alpha[l] = ((C[j] * (alpha[l] - 97) + k) % 26) + 97;
					}
					for(l=0; l<len; l++){
						if(str[l] == ' ') continue;
						for(m=0; m<26; m++){
							if(str[l] == alpha[m]){
							   	str[l] = m+97;
								break;	
							}
						}
					}
					printf("%s\n", str);
					goto NEXT;
				}
				strcpy(this, "this");
				strcpy(that, "that");
			}
		}
NEXT: ;
	}

	return 0;
}

int gcd(int x, int y){
	int r;

	while((r = x % y) != 0){
		x = y;
		y = r;
	}
	return y;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve()
{
	int n,m;cin>>n>>m;
	int arr[n];
	ll sum=0;
	for(int i=0;i<n;i++)
	cin>>arr[i],sum+=arr[i];
	int  ans=0;
	float x=(float)(sum)/(m*4);
	for(int i=0;i<n;i++)
	{
		if((arr[i]/1.0)>=x)
		++ans;
	}
	if(ans>=m)
	cout<<"Yes";
	else
	cout<<"No";
}
int main()
{
//	int t;cin>>t;
//	while(t--)
	solve();
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main(void)
{
	int a, b, ans;
	ans = 0;
	cin >> a>>b;
	for (int i = 0; i < 21; i++) {
		if (b > ((a - 1) * i + 1)) {
			ans++;
		}
	}

	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char S[51];
	scanf("%s", S);
	
	int i = 0, flag = 0;
	if (S[i] == 'A') i++;
	if (S[i] == 'K') i++;
	else flag = -1;
	if (S[i] == 'I') i++;
	else flag = -1;
	if (S[i] == 'H') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'B') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'R') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] != 0) flag = -1;
	
	if (flag == 0) printf("YES\n");
	else printf("NO\n");
	fflush(stdout);
	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int a[4];

int main() {
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    sort(a, a + 4);
    if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	int n=s.size();
	rep(i,0,n){
		if(i%2==0 && s[i]=='L'){
			cout<<"No";
			return 0;
		}
		else if(i%2==1 && s[i]=='R'){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	
	return 0;
}

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

int main()
{
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end());
    rep(i, n) cout << s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
W=[]
ans=0
for i in range(n):
    w=input()
    W.append(w)
    if i>0 and s[len(s)-1]==w[0]:
        ans=1
    elif i>0:
        ans=0
        break
    if W.count(w)!=1:
        ans=0
        break
    s=w
if ans==0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int x,i,n;
	cin>>x>>n;
	int a[101];
	
	for(int j=0;j<=101;j++)
	a[j]=0;
for(i=0;i<n;i++)
{
	int b;
	cin>>b;
	a[b]++;
}
if(a[x]==0)
{
	cout<<x;
	return 0;
}
 i=1;
while(1)
{
 if(x-i>=1 && x+i<=100)
 {
 	if(a[x-i]==0)
 	{
 		cout<<x-i;
 		return 0;
	 }
	 else if(a[x+i]==0)
	 {
	 	cout<<x+i;
	 	return 0;
	 }
 }
 else if(x-i<=0 && x+i<=100)
 {
 	cout<<x-i;
 	return 0;
 }
 else if(x-i>=1 && x+i>100)
 {
 	if(a[x-i]!=0)
 	{
	
 	cout<<x+i;
 	return 0;
 }
 	else
 	{
	 
 	cout<<x-i;
 	return 0;
 }
 }
 else if(x-i<=0 && x+i>100)
 {
 	cout<<min(x-i,x+i);
 	return 0;
 }
 i++;
}


	
}

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

int main()
{
    string s; cin >> s;
    
    for (int i = 0; i < s.length(); i++) {
        cout << 'x' ;
    }
    
}

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

typedef long long ll;
const ll mod = 1000000007;

int main() {
    int D, G, p[11], c[11];
    cin >> D >> G;
    for (int i = 0; i < D; i++) {
        cin >> p[i] >> c[i];
    }

    int ans = 1e9;
    for (int mask = 0; mask < (1 << D); mask++) {
        int s = 0, num = 0, rest_max = -1;
        for (int i = 0; i < D; i++) {
            if (mask >> i & 1) {
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            } else {
                rest_max = i;
            }
        }
        if (s < G) {
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if (need >= p[rest_max]) {
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

string S, T;
int q, a[110000], b[110000], c[110000], d[110000];
int imos_S[110000], imos_T[110000];

signed main() {
    cin >> S >> T >> q;
    for (int i = 0; i < q; i++)cin >> a[i] >> b[i] >> c[i] >> d[i];
    for (int i = 0; i < S.length(); i++) imos_S[i + 1] = S[i] == 'A' ? 1 : 2;
    for (int i = 0; i < T.length(); i++) imos_T[i + 1] = T[i] == 'A' ? 1 : 2;
    for (int i = 2; i <= S.length(); i++) imos_S[i] += imos_S[i - 1];
    for (int i = 2; i <= T.length(); i++) imos_T[i] += imos_T[i - 1];
    for (int i = 0; i < q; i++)
        cout << (((imos_S[b[i]] - imos_S[a[i] - 1]) % 3 == (imos_T[d[i]] - imos_T[c[i] - 1]) % 3) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 5760
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine().Split(' ');
            string N;
            int n;
            int k;
            n = int.Parse(s[0]);
            k = int.Parse(s[1]);
            var list = new List<string>();
            s = ReadLine().Split(' ');

            for (int i = 0; i < k; i++)
            {
                list.Add(s[i]);
            }

            bool b = false;
            while (b == false)
            {
                b = true;
                for (int i = 0; i < k; i++)
                {
                    N = n.ToString();
                    if (N.Contains(list[i]))
                    {
                        n++;
                        b = false;
                        break;
                    }
                }
            }


            WriteLine(n);
            Out.Flush();
        }

    }

    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return (m == 1 || m == 0) ? 1L : n * Pow(n, m - 1); }
    }
}

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

ll sovle(ll sum,ll cost){
	rep1(i,N-1){
		if(sum*(sum+a[i])<0)sum+=a[i];
		else{
			cost+=abs(sum+a[i])+1;
			sum=(sum>0?-1:1);
		}
	}
	return cost;
}

int main(){
	cin>>N;
	a.resize(N);
	rep(i,N)cin>>a[i];
	if(a[0]==0){
		cout<<min(sovle(1,1),sovle(-1,1))<<endl;
	}else{
		cout<<min(sovle(a[0],0),sovle((a[0]>0?-1LL:1LL),abs(a[0])+1))<<endl;
	}
}


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

int d[300005];
int main() {
  int N;
  cin >> N;
  for(int i=0; i<N; i++) cin >> d[i];
  for(int i=0; i<2; i++) {
    int a=0;
    for(int j=0; j<N; j++) {
      if(a<j*10){
        cout << "no" << endl;
        return 0;
      }
      a=max(a, j*10+d[j]);
    }
    reverse(d, d+N);
  }
  cout << "yes" << endl;
}

Measured memory_bytes: 4284
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
const int md = 1e9+7;
long long dp[13] = {1};
string s;
int main(){
	cin >> s;
	rep(i,s.size()){
		long long temp[13] = {};
		rep(j,13){
			if(s[i] != '?') temp[(j*10+s[i]-'0')%13] += dp[j];
			else rep(k,10) temp[(j*10+k)%13] += dp[j];
		}
		rep(j,13) dp[j] = temp[j] % md;
	}
	printf("%lld\n", dp[5]);
}

Measured memory_bytes: 512
n = int(input())
digit = [ 0 for i in range(10) ]
l = 0
for i in range(n):
    a, b = [ int(v) for v in input().split() ]
    digit[a] += b
    l += b

x = 0
for i in range(10):
    x += i*digit[i]

ans = l-1 # digit

a, b = divmod(x, 9)
if b == 0:
    a -= 1

ans += a
print(ans)


Measured memory_bytes: 45916
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B, C, D;

int main() {
	scanf("%lld %lld %lld %lld", &A, &B, &C, &D);
	ll ansForA = (A - 1) / C;
	// cout << ansForA << " ";
 	ansForA += (A - 1) / D;
 	// cout << ansForA << " ";
	ll ansForB = B / C;
	// cout << ansForB << " ";
	ansForB += B / D;
	// cout << ansForB << " ";
	ll lcm = (C * D) / __gcd(C, D);
	// cout << lcm << " ";
	ansForB -= B / lcm;
	ansForA -= (A - 1) / lcm;
	ansForB = B - ansForB;
	ansForA = (A - 1) - ansForA;
	printf("%lld\n", ansForB - ansForA);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 10004, NN = 1000006, M = 1000000007;
int a[N], lst[NN], cnt[NN];

ll power(int x, int y) {
	if (y == 0) {
		return 1;
	}
	ll temp = power(x, y >> 1);
	temp *= temp;
	temp %= M;
	if (y & 1) {
		temp *= x;
		temp %= M;
	}
	return temp;
}

void init() {
	for (int i = 2; i < NN; i++) {
		lst[i] = i;
	}
	for (int i = 2; i < NN; i++) {
		if (lst[i] == i) {
			for (int j = i + i; j < NN; j += i) {
				lst[j] = i;
			}
		}
	}
}

void fact(int x) {
	while (x > 1) {
		int hold = lst[x];
		int ccnt = 0;
		while (lst[x] == hold) {
			ccnt++;
			x /= lst[x];
		}
		cnt[hold] = max(cnt[hold], ccnt);
	}
}

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    init();
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		fact(a[i]);
	}
	int lcm = 1;
	for (int i = 0; i < NN; i++) {
		lcm = ((ll)lcm * power(i, cnt[i])) % M;
	}
	int res = 0;
	for (int i = 0; i < n; i++) {
		res += ((ll)lcm * power(a[i], M - 2)) % M;
		res %= M;
	}
	printf("%d", res);
    return 0;
}


Measured memory_bytes: 10096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  int n,m,c,d=0,e;
  cin>>n>>m>>c;
  int b[m],a[m];
  for(int i=0;i<m;i++) cin>>b[i];
  for(int i=0;i<n;i++){
    e=0;
    for(int j=0;j<m;j++){
      cin>>a[j];
      e+=a[j]*b[j];
    }
    if(e+c>0) d++;
  }
  cout<<d;
}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  string s;
  cin >> s;
  int n=s.size();
  
  repo(i,n){
    if(s[i]!='9')  {
    cout << s[0]-'1'+9*(n-1) << endl;
    return 0;
    }
  }
  
  cout << s[0]-'0'+9*(n-1) << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)

using namespace std;

int main() {
	int M=1e9+7;
	int h,w;cin>>h>>w;
	int dp[h+1][w+1];
	string a[h];
	FOR(i,0,h)cin>>a[i];
	
	FOR(i,0,h+1){
		FOR(j,0,w+1){
			if(i==0 || j==0)dp[i][j]=0;
			else if(i==1 && j==1)dp[i][j]=1;
			else{
				if(a[i-1][j-1]=='#'){
					dp[i][j]=0;
				}else{
					dp[i][j]=dp[i-1][j]+dp[i][j-1];
					dp[i][j]%=M;
				}
			}
		}
	}
	cout<<dp[h][w]<<endl;
	
	return 0;
}

Measured memory_bytes: 9360
#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

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

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

// constexpr inline ll mod = 1'000'000'007;
constexpr int max_n = 1000'000'000;

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    int n, k;
    cin >> n >> k;
    vector<int> a_s(n);
    rep(i, n) { cin >> a_s[i]; }

    auto good = [&](int len) -> bool {
        int cnt = 0;
        rep(i, n) {
            cnt += (a_s[i] - 1) / len;
        }
        return cnt <= k;
    };

    int ok = max_n, ng = 0;
    while (abs(ok - ng) > 1) {
        int mid = ng + (ok - ng) / 2;
        if (good(mid))
        {
            ok = mid;
        }
        else
        {
            ng = mid;
        }
    }
    cout << ok << endl;

    return 0;
}


Measured memory_bytes: 3944
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn = 500005;

int f[maxn];
int pre[maxn];

int main() {
#ifdef suiyuan2009
  freopen("in.cpp","r",stdin);
#endif
  string s;
  int n;
  cin>>n;
  cin>>s;
  memset(pre,-1,sizeof(pre));
  for(int i=0;i<n;i++){
    if(i)pre[i]=pre[i-1];
    if(s[i]=='0')pre[i]=i;
  }
 // cout<<n<<endl;
  for(int i=0;i<n;i++){
    if(i)f[i]=f[i-1];
    if(s[i]=='1'&&i){
      if(i>=2&&s[i-1]=='0'&&s[i-2]=='1'){
        int pos=pre[i-2];
        if(pos==-1){
          f[i]=max(f[i],i-1);
        } else {
          f[i]=max(f[i],f[pos]+i-2-pos);
          if(pos+1<i-2)f[i]=max(f[i],f[pos+1]+i-2-pos-1);
        }
      }
      if(s[i-1]=='1'){
        int pos=pre[i-1];
        if(pos>=1&&s[pos-1]=='1'){
          f[i]=max(f[i],(pos-2>=0?f[pos-2]:0)+i-pos);
        }
      }
    }
   // cout<<i<<" "<<f[i]<<endl;
  }
  cout<<f[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 4740
n, m = list(map(int, input().split()))
li = sorted([list(map(int,input().split())) for i in range(n)])
result = 0

for i in range(n):
    if m >= li[i][1]:
        m -= li[i][1]
        result += li[i][0] * li[i][1]
    else:
        result += li[i][0] * m
        break
print(result)

Measured memory_bytes: 28652
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,k;
  cin >> n >> k;
  vector<int>a(n);
  rep(i,n)cin >> a.at(i);
  vector<int>b(200010);
  int count = 0;
  rep(i,n) b.at(a.at(i))++;
  rep(i,200010) if(b.at(i)>=1) count++;
  rep(i,200010) if(b.at(i) == 0 ) b.at(i)=300000;
  sort(b.begin(),b.end());  
  int num = 0;
  if(k < count){
  rep(i,(count-k)){
    num += b.at(i);
  }
  }
  cout << num << endl;
//  cout << count << endl;
}

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

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

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

	string s;
	cin >> s;

	int len = s.size();

	if(len <= k) cout << s << "\n";
	else cout << s.substr(0, k) << "..." << "\n";

	return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var a = io.I;
        var b = io.I;
        var c = io.I;
        var d = io.I;

        var top = Max(a, c);
        var tail = Min(d, b);

        io.Write(Max(0, tail - top));
    }
}

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

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto &x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))
	
template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() { }
void print() { }
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << endl; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

//=========================

void run_test() {
	int n; read(n);
	vi p(n); trav(_p, p) read(_p);
	println(accumulate(all(p), 0) - *max_element(all(p)) / 2);
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=2e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int n;
int l[N],r[N];
int p,q;

int main()
{
    read(n);
    Rep(i,1,n)read(l[i]),read(r[i]);
    sort(l+1,l+n+1);
    sort(r+1,r+n+1);
    if(n%2==0){
        p=l[n>>1]+l[(n>>1)+1],q=r[n>>1]+r[(n>>1)+1];
        printf("%d\n",q-p+1);
    }
    else{
        p=l[n+1>>1],q=r[n+1>>1];
        printf("%d\n",q-p+1);
    }
    return 0;
}

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

using namespace std;

int main(int argc, char* argv[])
{
    if(argc == 2 or argc == 3) freopen(argv[1], "r", stdin);
    if(argc == 3) freopen(argv[2], "w", stdout);
    ios::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) < abs(x - b)) cout << "A" << endl;
    else cout << "B" << endl;
    return 0;
}


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 ll long long
#define pb push_back
#define endl "\n"

const ll N = 1e6 + 7;
const double PI = acos(-1);
ll mod = 1e9 + 7;

ll presum[N];

int32_t main()
{
    
    IOS
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    ll n, k;
    cin>>n>>k;
    ll ans = 0;
    vector<pair<ll, ll>> vp;
    for(ll i=1;i<=n;i++)
    {
    	ll tmp = n/i;
    	i = n/tmp;
    	ll d = n/i;
    	ll d1 = n/(i+1);
    	ll v = d - d1;
    	vp.pb({v, v});
    }
    // for(auto it: vp)
    // {
    // 	cout<<it.first<<" "<<it.second<<endl;
    // }
    // cout<<endl;
    for(int j=2;j<=k;j++)
    {
    	ll sum = 0;
    	for(int i=vp.size()-1;i>=0;i--)
    	{
    		sum += vp[i].first;
    		sum %= mod;
    		presum[vp.size()-1-i] = sum;
    	}
    	for(int i=0;i<vp.size();i++)
    	{
    		vp[i].first = (vp[i].second * presum[i]) % mod;
    		vp[i].first %= mod;
    	}
    }
    // for(auto it: vp)
    // {
    // 	cout<<it.first<<" "<<it.second<<endl;
    // }
    // cout<<endl;
    for(int i=0;i<vp.size();i++)
    {
    	ans += vp[i].first;
    	ans %= mod;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull; 
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vi d(n);
    FOR(i,0,n){
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    cout << d[n-1] - d[0];
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int N,T;
  cin>>N>>T;
  vector<int>c(N);
  vector<int>t(N);
  int MIN=0;

  for(int i=0;i<N;i++){
  cin>>c.at(i)>>t.at(i);
  }
  for(int i=0;i<N;i++){
    if(c.at(MIN)>c.at(i)&&T>=t.at(i)){
    MIN=i;
    }
    }
    if(T>=t.at(MIN))cout<<c.at(MIN)<<endl;
    else cout<<"TLE"<<endl;
    }

   
  
   


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

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

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
fast_io
int n; cin>>n;
cout<<(n/3);
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1000000007;

ll mod(ll a) {
  return (a % 2019);
}

void solve() {
  ll l, r;
  cin >> l >> r;
  ll x = r - l;
  ll ans = 2020;
  if (x >= 2019) ans = 0;
  else {
    if (mod(l) > mod(r)) ans = 0;
    else {
      for (ll i = mod(l); i <= mod(r); i++) {
        for (ll j = i+1; j <= mod(r); j++) {
          ans = min(ans, mod(i*j));
        }
      }
    }
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define F first
#define S second
typedef pair<int,int> PI;

string in;
int p;
typedef long long ll;

ll rec(){
  if(in[p]!='['){
    int ret = 0;
    while(isdigit(in[p])){
      ret=(in[p]-'0')+ret*10;
      ++p;
    }
    //cout << ret << endl;
    return (ret+1)/2;
  }

  vector<ll> ve;
  
  ++p;
  while(in[p]!=']'){
    ve.pb(rec());
    //++p;
  }
  ++p;
  
  sort(ALL(ve));
  ll sum = 0;
  rep(i,SZ(ve)/2+1) sum += ve[i];
  return sum;
}

void solve(){
  cin >> in;
  p=0;
  cout << rec() <<endl;
}

int main(){
  int n;
  cin >> n;
  rep(i,n) solve();
}

Measured memory_bytes: 1300
a,b=input().split()
import math
numbers=[]
for c in range(1,math.ceil(100100**0.5)):
    d=c**2
    numbers.append(str(d))
a=[e for e in a]
b=[f for f in b]
moji=''
for g in a:
    moji+=g
for h in b:
    moji+=h
if moji in numbers:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String tile = sc.next();
		int cnt0 = 0;
		int cnt1 = 0;
		for(int i = 0; i < tile.length(); i++){
			if(i%2 == 0){
				if(tile.charAt(i) != '0'){
					cnt0++;
				}
			}
			if(i%2 == 1){
				if(tile.charAt(i) != '1'){
					cnt0++;
				}
			}
			if(i%2 == 0){
				if(tile.charAt(i) != '1'){
					cnt1++;
				}
			}
			if(i%2 == 1){
				if(tile.charAt(i) != '0'){
					cnt1++;
				}
			}
		}
		System.out.println(Math.min(cnt0,cnt1));
	}
}

Measured memory_bytes: 23844
object Main extends App {
  import io.StdIn._
  val inputs = readLine().split(' ')
  val a1 = inputs(0).toLong
  val b1 = inputs(1).toLong
  val K = inputs(2).toLong
  val (a2, b2) = if (a1 >= K) {
    (a1 - K, b1)
  } else if (a1 + b1 >= K) {
    (0L, b1 - (K - a1))
  } else {
    (0L, 0L)
  }
  println(s"$a2 $b2")
}


Measured memory_bytes: 27084
#include<stdio.h>
int main(){
  int n,m,m1,m2,p1,p2;
  for(scanf("%d",&n);n;n--){
    scanf("%d %d %d %d",&p1,&p2,&m1,&m2);
    m=m1*p1+m2*p2;
    if(m1<5)m1=5;
    if(m2<2)m2=2;
    if(m>(m1*p1+m2*p2)*0.8)m=(m1*p1+m2*p2)*0.8;
    printf("%d\n",m); 
  }
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
int main() {
ll n;
cin>>n;
ll aa=0;
ll counter=0;
for(ll i=1; i>0; i++){
aa+=i;
counter++;
if(aa==n){
cout<<counter<<endl;
break;}
else if(aa>n){
cout<<counter<<endl;
break;}}}



Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph2 {
	private int totalVertex;
	private int totalEdge;
	private int[][] adjList;
	private int[] inDegree;
	private int[] outDegree;
	private LinkedList<Integer> pre = new LinkedList<Integer>();
	private int[] visited;
	private LinkedList<Integer> post = new LinkedList<Integer>();
	//adjacency list of edges
	public Graph2() { 
		totalVertex = 0; 
		totalEdge = 0; 
		adjList = null;
		inDegree = outDegree = null;
	}
	//given graph is in edge list
	public void loadEdgeList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		totalEdge = in.nextInt();
		adjList = new int[totalVertex][totalVertex];
		outDegree = new int[totalVertex];
		inDegree = new int[totalVertex];
		for(int i = 0; i < totalVertex; i ++) outDegree[i] = inDegree[i] = 0;
		for(int i = 0; i < totalEdge; i ++) {
			int u = in.nextInt();
			int v = in.nextInt();
			adjList[u][outDegree[u]] = v;
			outDegree[u] ++;
			inDegree[v] ++;
		}
		in.close();
		visited = new int[totalVertex];
		for(int i = 0; i < totalVertex; i ++) {
			visited[i] = 0;
		}
	}
	public void DFS(int s) {
		pre.add(s); //ordering of the vertices based on when they are "discovered"
		visited[s] = 1;
		for(int i = 0; i < outDegree[s]; i ++) {
			int w = adjList[s][i]; 
			//if(!pre.contains(w)) { //using this won't pass the last test case (time exceeds)
			if(visited[w] == 0) {
				DFS(w);
			}
		}
		post.add(s); //ordering of the vertices after completion of DFS
	}
	public LinkedList<Integer> topSortDFS() {
		for(int i = 0; i < totalVertex; i ++) {
			if(inDegree[i] == 0) DFS(i);
		}	
		LinkedList<Integer> s = new LinkedList<Integer>();
		Iterator<Integer> it = post.iterator();
		while(it.hasNext()) {
			int u = it.next();
			s.add(0, u);
		}
		return s;
	}
	public LinkedList<Integer> topSortQueue() {
		LinkedList<Integer> q = new LinkedList<Integer>();
		LinkedList<Integer> s = new LinkedList<Integer>();
		int i;
		for(i = 0; i < totalVertex; i ++) {
			if(inDegree[i] == 0) q.add(i);
		}
		while(!q.isEmpty()) {
			int u = q.remove(0); //take the first one
			s.add(u);
			for(i = 0; i < outDegree[u]; i ++) {
				int v = adjList[u][i];
				inDegree[v] --; 
				if(inDegree[v] <= 0) {
					q.add(v);
				}
			}
		}
		return s;
	}	
}

public class Main {
	public static void main(String argv[]) {
		Graph2 g = new Graph2();
		g.loadEdgeList();
		LinkedList<Integer> s = g.topSortDFS();
		//LinkedList<Integer> s = g.topSortQueue();
		Iterator<Integer> it = s.iterator();
		while(it.hasNext()) System.out.println(it.next());
	}
}


Measured memory_bytes: 557520
#include<bits/stdc++.h>
using namespace std;
pair<int,int> pii;
vector<int> vec;
int main()
{
  string s;

  cin>>s;
  for(int i=0; i<s.size(); i++){
    cout<<'x';
  }
  cout<<'\n';
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
double a,b;
int main(){
 	cin>>a>>b;
 	for(double i=1;i<=20000;i++){
 		if(floor(i*0.08)==a&&floor(i*0.1)==b){cout<<i<<endl;return 0;}
	}
	puts("-1");
  	return 0;
}

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

using namespace std;

#define int long long
#define ll long long
#define double long double
#define f first
#define s second
#define all(el) el.begin(), el.end()
#define allr(el) el.rbegin(), el.rend()
//#define x first
//#define y second
#define pb push_back
#define in insert
#define mp make_pair
#define sz(el) (int)el.size()
#define endl "\n"

const double pi = 3.141592653589793238462;

signed main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double mm2 = (double)m;
    double mm1 = ((double)h + ((double)m / (double)60)) * ((double)15 / (double)3);
    
    double help = (double)90 / (double)15;
    double ans = (double)mm1 * help - (double)mm2 * help;
    
    ans /= (double)180 / pi;

    
    cout << fixed << setprecision(9) << sqrt(a * a + b * b - 2 * a * b * cos(ans));
    
    return 0;
    
}


Measured memory_bytes: 4124
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
  int i, j, k , N, Q,ans = 0;
  char S[4], T[4];
  scanf("%s", S);
  scanf("%s", T);

  for (i = 0; i < 3; i++) {
    if (S[i] == T[i]) {
      ans++;
    }
  }
  printf("%d", ans);
  return 0;
  }

Measured memory_bytes: 128
import math
a,b = input().split()
a = int(a)
b = str(b)

c = a*int(b[0])
d = a*int(b[2])
e = a*int(b[3])

d = str(d)
e = str(e)

if d != '0' and e != '0':
    f = d[0:-1]
    if len(e) >= 2:
        g = e[0:-2]
    else:
        g = 0
    if len(e) >= 2:
        h = 10*int(d[-1]) + int(e[-1]) + 10*int(e[-2]) 
    else:
        h = 10*int(d[-1]) + int(e[-1])
    if h >= 100:
        h = h//100
    else:
        h = 0
elif d == '0':
    f = 0
    if len(e) >= 2:
        g = e[0:-2]
    else:
        g = 0
    if len(e) >= 2:
        h = int(e[-1]) + 10*int(e[-2])
    else:
        h = int(e[-1])
    if h >= 100:
        h = h//100
    else:
        h = 0
else:
    f = d[0:-1]
    g = 0
    h = 10*int(d[-1])
    if h >= 100:
        h = h//100
    else:
        h = 0

ans = c + int(f) + int(g) + h

print(ans)


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

int main(){
	int n,m,l,A[100][100],B[100][100];
	long long C[100][100]={0}; //C???????????????????????£??\???????????????????????§C?????????,int?????§?????¨????????????
    cin >> n >> m >> l;
    for(int i=0; i<n; i++)
    	for(int j=0; j<m; j++)cin >> A[i][j]; //A?????????????????????????????¢??§????????????

    for(int i=0; i<m; i++)
    	for(int j=0; j<l; j++)cin >> B[j][i]; //B??????????????????????????????????????????????????????

    for(int i=0; i<n; i++){
    	for(int j=0; j<l; j++){
    		for(int k=0; k<m; k++){ //??????C?????????????????????????????????????????????????????§???????????????
                C[i][j]+=A[i][k]*B[j][k];
            }
            if(j)cout << " "; //??????????????§???????????°????§??????????
    		cout << C[i][j]; //??????
    	}
    	cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3228
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
string S;
int cnt;
string now, pre;

int check_count(string s){
  int trgt = 0;
  while (trgt < s.size()){
    now += s[trgt];
    if (now != pre){
      pre = now;
      now = "";
      cnt++; trgt++;
      continue;
    }
    trgt++;
  }

  if (now == pre) return cnt--;
  return cnt;
}

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

  cin >> S;
  cnt = 0;
  pre = "";
  int ans1 =check_count(S);
  if (S.size() == 1) {
    cout << 1 << endl;
    return 0;
  }
  pre = "";
  string T = S.substr(2, S.size()-2);
  cnt=1;
  int ans2 = check_count(T);
  cout << max(ans1, ans2) <<endl;

  return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

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

	int n, m; cin >> n >> m;
	int v[100010][2] = {0};

	for(int i = 0; i < n; i++){
		v[i][0] = v[i][1] = 0;
	}

	int a; string b;
	for(int i = 0; i < m; i++){
		cin >> a >> b;
		if(b == "AC" && v[a-1][0] == 0) v[a-1][0]++;
		else if(b == "WA" && v[a-1][0] == 0) v[a-1][1]++;
	}

	int ans1 = 0, ans2 = 0;
	for(int i = 0; i < n; i++){
		ans1 += v[i][0];
		if(v[i][0] == 1)
			ans2 += v[i][1];
	}

	cout << ans1 << ' ' << ans2 << '\n';

	return 0;
}


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

using namespace std;

int main()
{
    string N;
  	cin >> N;
  	int flag;
  
  	for(int i = 0; i < 3; i++){
      if(N[i] == '7'){
      	flag++;
      }
    }
  if(flag > 0){
    cout << "Yes";
  }
  
  else{
  	cout << "No";
  }
}

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

int main()
{
    int N, A, B;
    scanf("%d %d %d", &N, &A, &B);
    if (N*A>B)
    {
        printf("%d", B);
    }
    else
    {
        printf("%d", N*A);
    }
    return 0;
}

Measured memory_bytes: 256