akhauriyash/Code-Regression huggingface dataset:
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

vector< vector<int> > ruiB;
vector< vector<int> > ruiW;
int K;
int getB(int X,int Y){
	if( X < 0 || Y < 0 ){
		return 0;
	}
	if( X >= 2*K ){
		X = 2*K-1;
	}
	if( Y >= 2*K ){
		Y = 2*K-1;
	}
	return ruiB[X][Y];
}
int getW(int X,int Y){
	if( X < 0 || Y < 0 ){
		return 0;
	}
	if( X >= 2*K ){
		X = 2*K-1;
	}
	if( Y >= 2*K ){
		Y = 2*K-1;
	}
	return ruiW[X][Y];
}

int calB(int X1,int Y1,int X2,int Y2){
	int ret = getB(X2,Y2);
	ret -= getB(X2,Y1-1);
	ret -= getB(X1-1,Y2);
	ret += getB(X1-1,Y1-1);
	return ret;
}

int calW(int X1,int Y1,int X2,int Y2){
	int ret = getW(X2,Y2);
	ret -= getW(X2,Y1-1);
	ret -= getW(X1-1,Y2);
	ret += getW(X1-1,Y1-1);
	return ret;
}
void solve(){
	int N;
	cin >> N >> K;
	vector<int> X(N),Y(N);
	vector<string> C(N);
	for(int i=0;i<N;++i){
		cin >> X[i]>>Y[i]>>C[i];
		X[i] %= (2*K);
		Y[i] %= (2*K);
	}
	////////////////
	ruiB = vector< vector<int> > (2*K,vector<int>(2*K,0));
	ruiW = vector< vector<int> > (2*K,vector<int>(2*K,0));
	int sumB = 0;
	int sumW = 0;
	for(int i=0;i<N;++i){
		if( C[i] == "B" ){
			++sumB;
			ruiB[X[i]][Y[i]]++;
		}else{
			++sumW;
			ruiW[X[i]][Y[i]]++;
		}
	}
	for(int R=0;R<2*K;++R){
		for(int C=1;C<2*K;++C){
			ruiB[R][C] += ruiB[R][C-1];
			ruiW[R][C] += ruiW[R][C-1];
		}
	}
	for(int R=1;R<2*K;++R){
		for(int C=0;C<2*K;++C){
			ruiB[R][C] += ruiB[R-1][C];
			ruiW[R][C] += ruiW[R-1][C];
		}
	}
	
	int ans = 0;
	for(int R=0;R<=K;++R){
		for(int C=0;C<=K;++C){
			int resB = 0;
			resB = calB(R-K,C-K,R-1,C-1);
			resB += calB(R,C,R+K-1,C+K-1);
			resB += calB(R+K,C+K,R+K+K-1,C+K+K-1);
			resB += calB(R-K,C+K,R-1,C+K+K-1);
			resB += calB(R+K,C-K,R+K+K-1,C-1);

			int resW = 0;
			resW = calW(R-K,C-K,R-1,C-1);
			resW += calW(R,C,R+K-1,C+K-1);
			resW += calW(R+K,C+K,R+K+K-1,C+K+K-1);
			resW += calW(R-K,C+K,R-1,C+K+K-1);
			resW += calW(R+K,C-K,R+K+K-1,C-1);
			
			int ret = 0;
			ret = max(resB+sumW-resW,resW+sumB-resB);
			ans = max(ans,ret);
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 37888
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    long long sum=0;
    for(int bit=0;bit < (1<<(s.size()-1));bit++){
        long long tmp=0,cur=0;
        for(int i=0;i<s.size()-1;i++){
            tmp += s[i] - '0';
            if(1&(bit>>(s.size()-2-i))){
                cur += tmp;
                tmp = 0;
            }
            else tmp *= 10;
        }
        tmp += s[s.size()-1] - '0';
        cur += tmp;
        sum += cur;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int A = one.get(0);
		int B = one.get(1);
		if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0){
			myout("Possible");
		}else{
			myout("Impossible");
		}
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 25464
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            int[][] set = new int[1000000][];

            while (true)
            {
                set[i] = new int[2];
                string[] input = Console.ReadLine().Split(' ');
                set[i][0] = int.Parse(input[0]);
                set[i][1] = int.Parse(input[1]);
                if (set[i][0] == 0 & set[i][1] == 0) break;
                i++;
            }
            for (int k = 0; k < i; k++)
            {


                for (int t = 0; t < set[k][0]; t++)
                {


                    for (int p = 0; p < set[k][1]; p++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}

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

using namespace std;

using int64 = long long;
const int INF = 1 << 30;

int main()
{
  int64 N, C[500], S[500], F[500];

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

  for(int i = 0; i < N - 1; i++) {
    int64 t = 0;
    for(int j = i; j < N - 1; j++) {
      t = max(t, S[j]);
      t = S[j] + C[j] + (t - S[j] + F[j] - 1) / F[j] * F[j];
    }
    cout << t << endl;
  }
  cout << 0 << endl;


}

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


void solve(long long H, long long N, std::vector<long long> A, std::vector<long long> B){
    vector<vector<ll>> dp(N+1,vector<ll>(H+1, 1e18));
    dp[0][0] = 0;
    for(int i = 0;i < N;i++){
        for(int j = 0;j <= H;j++){
            if(dp[i][j] == 1e18)continue;
            ll sum = j + A[i];
            sum = min(sum, H);
            dp[i+1][sum] = min(dp[i+1][sum], dp[i][j] + B[i]);
            dp[i+1][j] = min(dp[i][j], dp[i+1][j]);
            dp[i][sum] = min(dp[i][j] + B[i], dp[i][sum]);
        }
    }
    cout<<dp[N][H]<<endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(H, N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 78592
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,m1,a1,s1,b1,m2,a2,s2,b2,a[N],c1[N],c2[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(i&1){
			c1[a[i]]++;
			if(c1[a[i]]>m1){
				if(!a1){
					a1=a[i];
				}
				if(a1!=b1){
					s1=m1;
					b1=a1;
				}
				m1=c1[a[i]];
				a1=a[i];
			}else if(c1[a[i]]>s1){
				s1=c1[a[i]];
				b1=a[i];
			}
		}else{
			c2[a[i]]++;
			if(c2[a[i]]>m2){
				if(!a2){
					a2=a[i];
				}
				if(a2!=b2){
					s2=m2;
					b2=a2;
				}
				m2=c2[a[i]];
				a2=a[i];
			}else if(c2[a[i]]>s2){
				s2=c2[a[i]];
				b2=a[i];
			}
		}
	}
	if(a1==a2){
		printf("%d\n",min(n-m1-s2,n-s1-m2));
	}else{
		printf("%d\n",n-m1-m2);
	}
	return 0;
}

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

int main()
{
        int cnt[26];
        for (int i = 0; i < 26; ++i) {
                cnt[i] = 0;
        }

        string s;
        while (getline(cin, s)) {
                int len = s.length();
                for (int i = 0; i < len; ++i) {

                        char c = s[i];
                        if (c >= 'a' && c <= 'z') {
                                cnt[c - 'a'] += 1;
                        }
                        else if (c >= 'A' && c <= 'Z') {
                                cnt[c - 'A'] += 1;
                        }
                }
        }

        for (int i = 0; i < 26; ++i) {
                char c = 'a' + i;
                cout << c << " : " << cnt[i] << endl;
        }

}



Measured memory_bytes: 3216
m = int(input())
for i in range(m):
    d = input()
    trains = [d]
    for j in range(1, len(d)):
        f, b = d[:j], d[j:]
        rf, rb = f[::-1], b[::-1]
        trains.extend([rf+b, f+rb, rf+rb, b+f, rb+f, b+rf, rb+rf])
    print(len(set(trains)))

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

using namespace std;

int main() {
  int N;
  cin>>N;
  
  int num = 0;
  for(int i=1; i<=9; i++) {
    if(N%i==0) {
      num = N / i;
    }
  }

  if(num<=9 && N/num<=9) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
}


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

int main(){
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<ll>> dp(n+1,vector<ll>(13));
	dp[0][0] = 1;
	rep(i,n){
		int c;
		if(s[i] == '?') c = -1;
		else c = s[i] - '0';
		rep(j,10){
			if(c != -1 && c != j) continue;
			rep(ki,13){
				dp[i+1][(ki*10+j)%13] += dp[i][ki];
				dp[i+1][(ki*10+j)%13] %= mod;
			}
		}
	}
	cout << dp[n][5] << endl;
	return 0;
}

Measured memory_bytes: 13696
package main

import "fmt"

func main() {
	var p [4][3][10]int
	var n, b, f, r, v int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&b, &f, &r, &v)
		b--
		f--
		r--
		p[b][f][r] += v
	}
	// fmt.Println(p)
	for i := 0; i < 4; i++ {
		if i > 0 {
			fmt.Println("####################")
		}
		for j := 0; j < 3; j++ {
			for k := 0; k < 10; k++ {
				fmt.Print(" ", p[i][j][k])
			}
			fmt.Println()
		}
	}
}



Measured memory_bytes: 1136
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll = long long int;

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

ll INF = 1000000000000000000;

ll fun(ll fs) {
  ll i = 1;
  ll a = 0;
  while (1) {
    a += i;
    if (fs < a) {
      return i - 1;
    }
    i++;
  }
}


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

  ll k = 2;
  ll sq = static_cast<ll>(sqrt(n));

  ll sum = 0;

  while (k <= sq + 10) {
    ll fs = 0;
    while (n % k == 0) {
      fs++;
      n /= k;
    }

    if (fs > 0) {
//      cout << k << endl;
    }

    ll tmp = fun(fs);
//    cout << tmp << endl;
    sum += tmp;

    k++;
  }

  // prime number
  if (n > 1) {
//    cout << "prime" << endl;
    sum++;
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define int long long
signed main(){
    int n;
    cin>>n;
    vi a(n);
    vi b(n);
    vi c(n);
    REP(i,n){
        cin>>a[i];
    }
    REP(i,n){
        cin>>b[i];
    }
    REP(i,n){
        cin>>c[i];
    }
    sort(all(a));
    sort(all(c));
    int ans=0;
    REP(i,n){
        auto p=lower_bound(all(a),b[i]);
        p--;
        auto q=upper_bound(all(c),b[i]);
        cerr<<p-a.begin()+1<<" "<<c.end()-q<<endl;
        ans+=(p-a.begin()+1)*(c.end()-q);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include<cstdio>

int h, w;
char s[102][102];
int dp[102][102];

int min(int x, int y) {
  return x < y ? x : y;
}

int main() {
  scanf("%d %d", &h, &w);
  for (int i = 0; i < h; i++) {
    scanf("%s", s[i+1]+1);
  }
  for (int i = 0; i <= h; i++) {
    dp[i][0] = 100000;
  }
  for (int j = 0; j <= w; j++) {
    dp[0][j] = 100000;
  }
  dp[1][1] = s[1][1] == '#' ? 2 : 1;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (i == 1 && j == 1) {
        continue;
      }
      dp[i][j] = min(dp[i-1][j]+(s[i][j]==s[i-1][j]?0:1), dp[i][j-1]+(s[i][j]==s[i][j-1]?0:1));
    }
  }
  printf("%d\n", dp[h][w]/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string x;
  cin >> x;
  if(x == "A")
    cout << "T" <<endl;
  else if(x == "T")
    cout << "A" <<endl;
  else if(x == "G")
    cout << "C" <<endl;
  else if(x == "C")
    cout << "G" <<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Sqrt(int.Parse(Read().Replace(" ","")));
            if (ab % 1 == 0)
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
        }
        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/a.in", "r", stdin);
//  freopen("../IO/a.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}




void solve(std::istream &in, std::ostream &out) {
  int N;
  in >> N;
  N = 1000 * ((N + 1000 - 1) / 1000) - N;
  out << N;
}

Measured memory_bytes: 3628
NM=input()
NM=NM.rstrip().split(" ")
N=int(NM[0])
M=int(NM[1])

list1=[]
for i in range(N):
    line=input()
    line=line.rstrip().split(" ")
    list1.append([int(line[0]),int(line[1]),int(line[2])])
    
#print(list1)

list111=[]
list011=[]
list101=[]
list110=[]

i=0
for i in range(N):
    a=0+list1[i][0]+list1[i][1]+list1[i][2]
    list111.append(a)
    b=0-list1[i][0]+list1[i][1]+list1[i][2]
    list011.append(b)
    c=0+list1[i][0]-list1[i][1]+list1[i][2]
    list101.append(c)
    d=0+list1[i][0]+list1[i][1]-list1[i][2]
    list110.append(d)
    
list111.sort()
list011.sort()
list101.sort()
list110.sort()
#print(list111)
#print(list011)
#print(list101)
#print(list110)
list2=[]
list2.append(abs(sum(list111[0:M])))
list2.append(abs(sum(list111[N-M:N])))
list2.append(abs(sum(list011[0:M])))
list2.append(abs(sum(list011[N-M:N])))
list2.append(abs(sum(list101[0:M])))
list2.append(abs(sum(list101[N-M:N])))
list2.append(abs(sum(list110[0:M])))
list2.append(abs(sum(list110[N-M:N])))

print(max(list2))

Measured memory_bytes: 3440
#include<bits/stdc++.h>
#define N 200010
#define f first
#define s second
using namespace std;
typedef pair<int,int> P;  

int main(){
  int n,m;
  cin>>n>>m;
  P A[N];
  for(int i=0,x,y;i<m;i++)cin>>x>>y,A[i]=P(x,y-1);
  sort(A,A+m);

  int u[N],d[N];
  for(int i=0;i<n;i++) u[i]=d[i]=i;

  for(int i=0;i<m;i++){
    int y=A[i].s;
    u[y]=max(u[y],u[y+1]);
    d[y+1]=min(d[y+1],d[y]);
  }

  for(int i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<(u[i]-i)+(i-d[i])+1;
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 6192
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a%b)

A, B, K = map(int, input().split())
cnt = 0
ans = 0
for i in range(gcd(A, B), 0, -1):
    if A % i == 0 and B % i == 0:
        cnt += 1
        ans = i
    if cnt == K:
        print(ans)
        break
    i += 1

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		long m = scanner.nextLong();

		long cnt=0;
		if(m>=2*n) {
			cnt=n;
			m-=2*n;
			n=0;
		}
		else {
			cnt=m/2;
			if(m%2==0) {
				m=0;
			}else {
				m=1;
			}
			n-=m/2;
		}
		cnt+=m/4;
		System.out.println(cnt);
	}
}


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

const long long MOD = 2;

void solve(long long N, std::vector<long long> a) {
    vector<ll> b(N);
    for (ll i = N; i > 0; i--) {
        ll sum = 0;
        for (ll j = i + i; j <= N; j += i) {
            sum ^= b[j - 1];
        }
        b[i - 1] = sum ^ a[i - 1];
    }

    vector<ll> ans;
    for (ll i = 0; i < N; i++) {
        if (b[i]) ans.push_back(i + 1);
    }
    cout << ans.size() << endl;
    for (ll i = 0; i < ans.size(); i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> a(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 4980
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

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


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
    	Scanner scanner = new Scanner(System.in);
      
      	int N = scanner.nextInt();
      
      	int[] array = new int[N];

      	for(int i = 0; i < N; i++) {
          	array[i] = scanner.nextInt();
            //System.out.println(array[i]);
        }
      	int plus = 0;
      	double sum = 0;
      	for(int j = 0; j < N; j++) {
        	plus = plus + (int) Math.pow(array[j], 2);
          	sum = sum + array[j] * 2;
        }
      	sum = Math.round(sum / (2 * N));
      
      	int ans = 0;
      	for(int k = 0; k < N; k++) {
        	ans = ans + (int) Math.pow((array[k] - (int) sum), 2);
        }
      
     	System.out.println(ans);
      	
	}
}
 

 



Measured memory_bytes: 23636
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////

int main() {
ll ans = 0;
	vector<int> A(3);
	cin >> A.at(0) >> A.at(1) >> A.at(2);
	sort(ALL(A));
	while(A.at(0) < A.at(2)-1){A.at(0) += 2; ans ++;}
	sort(ALL(A));
	while(A.at(0) < A.at(2)-1){A.at(0) += 2; ans ++;}
	sort(ALL(A));

	if(A.at(0) == A.at(1) && A.at(1) == A.at(2)){}
	else if (A.at(0) == A.at(1)) ans ++;
	else ans +=2;

	cout << ans << endl;
}

Measured memory_bytes: 256
var a,b:array[1..100]of int64;
c,d:int64;
n,i:longint;
x,y,z:int64;
begin
    readln(n);
    for i:=1 to n do
    begin
        readln(a[i]);
        b[i]:=a[i];
    end;
    for i:=1 to n-1 do
    begin
        x:=a[i];
        y:=a[i+1];
        while (x>0) and (y>0) do
        begin
            if x>=y then
            begin
                x:= x mod y;
            end
            else
            if y>x then
            begin
                y:= y mod x;
            end;
        end;
        if x>0 then z:=x
        else z:=y;
        a[i+1]:=a[i]*(a[i+1] div z);
    end;
    writeln(a[n]);
end.

Measured memory_bytes: 128
// D - AtCoder Express 2
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	int l,r,N,M,Q; cin>>N>>M>>Q;
	vi L(M),R(M);
	rep(i, M) cin>>L[i]>>R[i];
	vvi X(N+1, vi(N+1, 0));
	rep(i, M) X[L[i]][R[i]]++;
	rep(l, N) rep(r, N) X[l+1][r+1] += X[l+1][r];
	rep(r, N) rep(l, N) X[l+1][r+1] += X[l][r+1];
	while(Q--){
		cin>>l>>r;
		cout<< X[r][r] - X[l-1][r] <<endl;
		// cout<< X[N][r] - X[l-1][r] <<endl;
		// cout<< X[r][r] - X[r][l-1] + X[l-1][l-1] - X[l-1][r] <<endl;
	}
}

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

int main(){
  int N,A,B;
  bool b=true;
  int sum=0;
  cin >> N >> A >> B;
  
  for(int X=1; X<=N; X++){
    int k = X;
    int a = 0;
    for(int j=0;j<5;j++){
    	a += k%10;
    	k = k/10;
  	}
  
  	if(A<=a&&a<=B){
    	sum += X;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int N;
	int a,b,c;
	int i;

	scanf("%d",&N);
	for(i = 0;i < N;i++){
		scanf("%d %d %d",&a,&b,&c);

		if(a*a+b*b == c*c){
			printf("YES\n");
		}else if(b*b+c*c == a*a){
			printf("YES\n");
		}else if(c*c+a*a == b*b){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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

int main(){
  vector<int> vec(3);

  for (int i = 0; i < 3; i++){
    cin >> vec.at(i);
  }

  sort(vec.begin(),vec.end());

  int sum = 0;
  for (int i = 0; i < 2; i++){
    sum += vec.at(i + 1) - vec.at(i);
  }

  cout << sum << endl;
}

Measured memory_bytes: 3580
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#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 rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,W;
    cin>>n>>W;
    vi v(n),w(n),l(n);
    rep(i,n)cin>>v[i]>>w[i]>>l[i];
    int dp[W+1]={};
    rep(i,n){
        for(int k=1;l[i]>0;k<<=1){
            int m=min(k,l[i]);
            for(int j=W;j>=w[i]*m;j--){
                dp[j]=max(dp[j],dp[j-w[i]*m]+v[i]*m);
            }
            l[i]-=m;
        }
    }
    int ans=0;
    rep(i,W+1)ans=max(ans,dp[i]);
    cout<<ans<<endl;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
using namespace std;
LL dp[2501][51];
int main(){
    LL n,a,t,ans=0;
    cin>>n>>a;
    dp[0][0]=1;
    for(int i=0;i<n;++i){
        cin>>t;
        for(int j=2500;j>=t;--j)
            for(int o=0;o<=i;++o)
                dp[j][o+1]+=dp[j-t][o];
    }
    for(int i=1;i<=2500;++i){
        if(i%a!=0||i/a>n)
            continue;
        ans+=dp[i][i/a];
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 1280
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		for(int i=0;i<3000;i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(x==0 && y==0) {
				break;
			}
			if(x>=y) {
				System.out.println(y + " " + x);
			}else {
				System.out.println(x + " " + y);
			}
		}

		sc.close();
	}
}


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

using namespace std;

#define ll long long

const int mxN = 1e5 + 3;
const int nul = 1e9 ;

int h[mxN] = {0};
int n, k;
int ans[mxN] = {0};
int temp[104] = {0};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n>>k;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    for (int i = 1; i < n; i++) {
        int temp = nul;
        for (int j = 1; j <= min(i, k); j++) {
            temp = min(ans[i - j] + abs(h[i] - h[i - j]),temp);
        }
        ans[i]=temp;
    }
    cout << ans[n - 1] << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        string card;
        cin >> card;

        vector<int> player(n, 0);
        int field = 0;
        for(int i=0; i<100; ++i){
            if(card[i] == 'M'){
                ++ player[i%n];
            }
            else if(card[i] == 'S'){
                field += player[i%n] + 1;
                player[i%n] = 0;
            }
            else{
                player[i%n] += field + 1;
                field = 0;
            }
        }

        sort(player.begin(), player.end());
        for(int i=0; i<n; ++i)
            cout << player[i] << ' ';
        cout << field << endl;
    }
}

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

using namespace std;

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

  int n;
  cin >> n;
  map<int, int> cnt;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    cnt[t]++;
  }
  int ans = 0;
  for (auto& it : cnt) {
    if (it.second < it.first) {
      ans += it.second;
    } else if(it.first < it.second) {
      ans += it.second - it.first;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 4736
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <numeric>
using namespace std;

#define repeat(i, x) for (int64_t i = 0; (i) < (int64_t)(x); ++(i))

const int inf = (1 << 28);

namespace TaskF {
    using Tree = vector<set<int>>;

    int n_;
    Tree aT_, bT_;
    vector<int> aParents_, bParents_;
    vector<int> deg_;
    vector<bool> use_;

    void DFSA(int u, int p) {
        aParents_[u] = p;
        for (int v : aT_[u]) {
            if (v != p) DFSA(v, u);
        }
    }

    void DFSB(int u, int p) {
        bParents_[u] = p;
        for (int v : bT_[u]) {
            if (v != p) DFSB(v, u);
        }
    }

    Tree inputTree() {
        Tree t(n_);
        repeat (i, n_ - 1) {
            int a, b;
            cin >> a >> b; a--; b--;
            t[a].insert(b);
            t[b].insert(a);
        }
        return t;
    }

    int solveWithFixed(int r) {
        DFSA(r, -1);
        DFSB(r, -1);

        fill(use_.begin(), use_.end(), false);

        queue <int> que;
        int cnt = 0;
        que.push(r);

        while (!que.empty()) {
            int v = que.front(); que.pop();
            use_[v]=true;
            cnt++;

            for (int to : aT_[v]) {
                if(to != aParents_[v] and bParents_[to] == v) que.push(to);
            }
        }
        repeat (j, n_) {
            deg_[j] = aT_[j].size() - 1;
        }

        while (true) {
            int v = -1;
            repeat (j, n_) {
                if(!use_[j] and deg_[j]==0 and use_[bParents_[j]]) {
                    v = j;
                    break;
                }
            }
            if(v == -1) break;
            use_[v]=true;
            deg_[aParents_[v]]--;
        }

        bool up=true;
        repeat (j, n_) {
            if(!use_[j]) {
                up=false;
            }
        }

        if(up) {
            int vl=n_-cnt;
            return vl;
        } else return inf;
    }

    void solve(int testNumber) {
        cin >> n_;

        aParents_.resize(n_, 0);
        bParents_.resize(n_, 0);
        deg_.resize(n_, 0);
        use_.resize(n_, false);

        aT_ = inputTree();
        bT_ = inputTree();

        int ans = inf;
        repeat (r, n_) {
            if (aT_[r].size() == 1) {
                int old = *aT_[r].begin();
                aT_[r].erase(old);
                aT_[old].erase(r);

                repeat (u, n_) {
                    if (r == u) continue;

                    aT_[r].insert(u);
                    aT_[u].insert(r);

                    ans = min(ans, solveWithFixed(r) + (old != u));

                    aT_[r].erase(u);
                    aT_[u].erase(r);
                }
                aT_[r].insert(old);
                aT_[old].insert(r);
            }
        }

        if (ans >= inf) ans = -1;
        cout << ans << endl;
    }
}

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

    repeat (_, T) {
        TaskF::solve(_);
    }

    return 0;
}


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


int main(){
    string s; cin >> s;
    long long res=0;
    for(int bits=0; bits<(1<<s.size()-1); bits++){
        vector<long long> num(s.size());
        for(int i=0; i<s.size(); i++){
            num[i]=s[i]-'0';
        }
        long long total=0;
        for(int i=0; i<s.size()-1; i++){
            if(bits & (1<<i)) continue;
            num[i+1]+=10*num[i];
            num[i]=0;
        }
        for(int i=0; i<s.size(); i++){
            total+=num[i];
        }
        res+=total;
    }
    cout << res << endl;
    return 0;
}

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

int main()
{
  int n, cakes, donuts;
  bool res = 0;
  cin >> n;

  for (cakes = 0; cakes <= 25; cakes++) {
    for (donuts = 0; donuts < 15; donuts++) {
      if (n == cakes * 4 + donuts * 7) res = 1;
    }
  }

  cout << (res ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
object Main extends App {
  var people = io.StdIn.readLine().toInt
  while(people != 0) {
    val incomes = io.StdIn.readLine().split(" ").map(_.toInt)
    println(incomes.filter(x => x <= (incomes.sum / incomes.size)).size)
    people = io.StdIn.readLine().toInt
  }
}


Measured memory_bytes: 568524
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll s;
  cin >> s;
  cout << s%9 << endl;
return 0;}

Measured memory_bytes: 256
from collections import deque

S = deque(input())
Q = int(input())

reverse = False
cnt = 0
for i in range(Q):
    inp = input().split()
    if inp[0] == "1":
        cnt += 1
        reverse = (cnt % 2 != 0)
        #S = S[::-1]
    else:
        f, c = inp[1:]
        if int(f) == 1:
            if reverse:
                S.append(c)
            else:
                S.appendleft(c)
        else:
            if reverse:
                S.appendleft(c)
            else:
                S.append(c)
S = "".join(S)
print(S[::-1] if reverse else S)

Measured memory_bytes: 8692
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
vec v[100010];
bool u[500010];
int now,q,n,ap[500010],f[500010],m,a[500010],used,A[500010],B[500010],AS,BS;
bool rem(){
	int t=0;
	FOR(i,1,m) if (!u[i]){
		if (ap[i]<t) return 0;
		t=ap[i];
	}
/*	AS=BS=0;
	FOR(i,1,q) if (!u[a[i]] && i==v[a[i]][0]) A[++AS]=a[i];
	FOR(i,1,m) if (!u[i]) B[++BS]=i;
	FOR(i,1,AS) if (A[i]!=B[i]) return 0;
*/	return 1;
}
int main(){
	cin>>n>>m>>q;
	FOR(i,1,q) getint(a[i]);
	reverse(a+1,a+q+1);
	FOR(i,1,n) f[i]=0;
	FOR(i,1,m) ap[i]=q+1;
	FOR(i,1,q){
		v[a[i]].pb(i);
		if (ap[a[i]]==q+1) ap[a[i]]=i;
	}
	now=1;
	while (now<=q){
		if (u[a[now]]){++now;continue;}
		if (rem()) return puts("Yes"),0;
		u[a[now]]=1;
		int t=0;
		FOR(i,1,n){
			while (t<SZ(v[a[now]]) && v[a[now]][t]<=f[i]) ++t;
			if (t>=SZ(v[a[now]])){
				int tt=1;
				return puts("No"),0;
			}
			f[i]=v[a[now]][t];
			++t;
		}
		++now;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 13952
#include <iostream>
#include <algorithm>
using namespace std;                  
                                      
int main(){                           
long long a,b,c,d;                    
cin>>a>>b>>c>>d;                      
cout<<max(max(a*d,b*d),max(a*c,b*c)); 
return 0;                             
}                                     


Measured memory_bytes: 3188
#include <stdio.h>
int main(){
  int m[999],f[999],r[999],i,j;

  for(i = 0;;i++){
    scanf("%d %d %d",&m[i],&f[i],&r[i]);
    if(m[i] == -1 && f[i] == -1 && r[i] == -1)break;
  }

  for(j = 0;j < i;j++){
    if(m[j] == -1 || f[j] == -1 || m[j] + f[j] < 30){
      printf("F\n");
    }
    else if(m[j] + f[j] >= 30 && m[j] + f[j] < 50 && r[j] < 50){
      printf("D\n");
    }
    else if((m[j] + f[j] >= 50 && m[j] + f[j] < 65) || r[j] >= 50){
      printf("C\n");
    }
    else if(m[j] + f[j] >= 65 && m[j] + f[j] < 80){
      printf("B\n");
    }
    else if(m[j] + f[j] >= 80){
      printf("A\n");
    }
  }
  
  return 0; 
}

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

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
using namespace std;
const int N = 2 * 1e5 + 10;
int n , m ;
int a , b , ans;
int x[N] , y[N] , can[N];
int cnt[N];
ld prb[N];

main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> m >> n;
	prb[1] = 1.0;
	can[1] = 1;
	for(int i = 1 ; i <= m ; i++)
		cnt[i]++;
	for(int i = 1 ; i <= n ; i++){
		cin >> x[i] >> y[i];
		if(can[x[i]]){
			can[y[i]] = 1;
		}
		cnt[y[i]]++;
		cnt[x[i]]--;
		if(!cnt[x[i]])
			can[x[i]] = 0;
	}
	for(int i = 1 ; i <= m ; i++)
		if(can[i])
			ans++;
		
		
	cout << ans;
	
}

Measured memory_bytes: 6784
#include <stdio.h>

int main() {
  int i, j, k, height, width, number_n, point_x, point_y, flag, count = 0;
  scanf("%d %d %d", &width, &height, &number_n);
  int picture[height][width];
  for(i = 0; i < height; i++) {
    for(j = 0; j < width; j++) {
      picture[i][j] = 1;
    }
  }
  for(i = 0; i < number_n; i++) {
    scanf("%d %d %d", &point_x, &point_y, &flag);
    if(flag == 1) {
      for(j = 0; j < height; j++) {
        for(k = 0; k < point_x; k++) {
          picture[j][k] = 0;
        }
      }
    } else if(flag == 2) {
      for(j = 0; j < height; j++) {
        for(k = point_x; k < width; k++) {
          picture[j][k] = 0;
        }
      }
    } else if(flag == 3) {
      for(j = 0; j < point_y; j++) {
        for(k = 0; k < width; k++) {
          picture[j][k] = 0;
        }
      }
    } else if(flag == 4) {
      for(j = point_y; j < height; j++) {
        for(k = 0; k < width; k++) {
          picture[j][k] = 0;
        }
      }
    }
  }
  for(i = 0; i < height; i++) {
    for(j = 0; j < width; j++) {
      count += picture[i][j];
    }
  }
  printf("%d\n", count);
  return 0;
}


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

int main()
{
  int n,k;
  cin >> n >> k;
  
  int h[n];
  int ans = 0;
  for(int i = 0; i < n; i++){
    cin >> h[i];
    if(h[i] >= k){
      ans++;
    }
  }
  
  cout << ans << endl;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

vector< int > e[MAX_N];
int N, M;
bool state[MAX_N];

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

  cin >> N >> M;
  vector< int > a(M);
  vector< int > b(M);
  REP(i, M) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    e[a[i]].emplace_back(b[i]);
    e[b[i]].emplace_back(a[i]);
  }

  // OK(true);

  /*
  vector< int > s;
  int mn = INF;
  REP(i, N) {
    if (e[i].size() < mn) {
      mn = e[i].size();
      s.clear();
      s.emplace_back(i);
    } else if(e[i].size() == mn) {
      s.emplace_back(i);
    }
    // mn = min(mn, e[i].size());
  }
  */

  // int last;
  vector< int > after_path;
  //REP(si, s.size())
  {
    // memset(state, false, sizeof(state));
    state[0] = true;
    
    int from = 0;
    after_path.emplace_back(from);
    bool ok = false;
    // debug(from);
    
    // OK(false);
    REP(i, N - 1) {
      EACH(to, e[from]) {
	if (state[to]) continue;
	from = to;
	state[from] = true;
	after_path.emplace_back(from);
	// debug(from);
	
	
	bool check = true;
	EACH(ti, e[from]) {
	  if (!state[ti]) {
	    check = false;
	    break;
	  }
	}
	if (check) ok = true;
	// last = from;
	break;
      }
      if (ok) break;
    }
  }

  vector< int > before_path;
  {
    // memset(state, false, sizeof(state));
    // state[0] = true;
    
    int from = 0;
    before_path.emplace_back(from);
    bool ok = false;
    // debug(from);
    
    // OK(false);
    REP(i, N - 1) {
      EACH(to, e[from]) {
	if (state[to]) continue;
	from = to;
	state[from] = true;
	before_path.emplace_back(from);
	// debug(from);
	
	
	bool check = true;
	EACH(ti, e[from]) {
	  if (!state[ti]) {
	    check = false;
	    break;
	  }
	}
	if (check) ok = true;
	// last = from;
	break;
      }
      if (ok) break;
    }
  }
  
  reverse(ALL(before_path));
  
  cout << after_path.size() + before_path.size() - 1 << endl;
  REP(pi, before_path.size() - 1) {
    cout << before_path[pi] + 1 << " ";
  }
  REP(pi, after_path.size()) {
    cout << after_path[pi] + 1;
    if (pi < after_path.size() - 1) cout << " ";
    else cout << endl;
  }
  
  /*
  REP(i, N) {
    cout << i + 1 << endl;
    EACH(si, e[i]) {
      debug(si+1);
    }

    cout << endl;
  }
  */

  return 0;
}



Measured memory_bytes: 7672
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=998244353;
const long long int INF=99999999999999999;

long long int n,m,sum,res=1,d[100005];
string str;
int main() {
	cout << fixed << setprecision(10);
    cin>>n>>str;
    for(int i=1;i<n;i++){
        if(str[i]!=str[i-1]){res++;}
    }
    
    cout<<res;
} 


Measured memory_bytes: 512
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var O = cin.Read.ToCharArray();
            var E = cin.Read.ToCharArray();
            
            var len = O.Length + E.Length;
            var ans = new char[len];
            for(int i = 1; i <= len; i++)
            {
                if(i % 2 == 1)
                {
                    ans[i - 1] = O[(i - 1) / 2];
                }
                else
                {
                    ans[i - 1] = E[(i - 1) / 2];
                }
            }
            WriteLine(ans);
        }

        public long C(int X, int Y)
        {

            if (Y == 0 || Y == X)
            {
                return 1;
            }
            if(X < Y)
            {
                return 0;
            }
            var Pascal = new long[X + 1, X + 1];
            for (int i = 0; i <= X; i++)
            {
                Pascal[i, 0] = 1L;
                Pascal[i, i] = 1L;
            }
            for (int i = 2; i <= X; i++)
            {
                for (int j = 1; j < i; j++)
                {
                    Pascal[i, j] = Pascal[i - 1, j] + Pascal[i - 1, j - 1];
                }
            }
            return Pascal[X, Y];
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13268
import Control.Monad

same a b g = elem a g && elem b g

main = do
  [a, b] <- (map read . words) <$> getLine :: IO [Int]
  let g1 = [1, 3, 5, 7, 8, 10, 12]
  let g2 = [4, 6, 9, 1]
  let g3 = [2]

  putStrLn $ if same a b g1 || same a b g2 || same a b g3 then "Yes" else "No"


Measured memory_bytes: 508
#include<stdio.h>
int main()
{
	int tasu=0,hiku=0,kakeru=0,A,B;
	scanf("%d%d",&A,&B);
	tasu=A+B;
	hiku=A-B;
	kakeru=A*B;
	if(tasu>=hiku && tasu>=kakeru) printf("%d\n",tasu);
	if(hiku>kakeru && hiku>tasu) printf("%d\n",hiku);
	if(kakeru>tasu && kakeru>hiku) printf("%d\n",kakeru);
	return 0;
}

	

Measured memory_bytes: 128
use std::cmp::Reverse;
use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let mut s: Vec<u8> = s.into_bytes();
    let t: String = parse_line().unwrap();
    let mut t: Vec<u8> = t.into_bytes();

    s.sort();
    t.sort_by_key(|&x| Reverse(x));
    if s.iter().lt(t.iter()) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2164