akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    int ans = 0;

    int x = S[0];

    for(int i = 1; i < S.length(); i++) {
        if(S[i] != x) {
            ans++;
            x = S[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		int a[n];
		int ma=INT_MAX;
		for(int i=0;i<n;i++){
			cin>>a[i];
			ma=min(ma,a[i]);
		}
		bool mark[n];
		for(int i=n-1;i>0;i--){
			if(a[i]>=a[i-1])
			continue;
			if(a[i-1]-a[i]>1){
				cout<<"No";
				return 0;
			}
			a[i-1]=a[i];
		}
		cout<<"Yes";
	}
	return 0;
}

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

int find(int X,vector<int> &U){
  if(U.at(X)<0){
    return X;
  }
  return U.at(X)=find(U.at(X),U);
}

void unite(int X,int Y,vector<int> &U){
  X=find(X,U);
  Y=find(Y,U);
  if(X==Y){
    return;
  }
  U.at(Y)+=U.at(X);
  U.at(X)=Y;
  return;
}

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> U(N,-1);
  for(int i=0;i<M;i++){
    int A,B;
    cin >> A >> B;
    A--;
    B--;
    unite(A,B,U);
  }
  sort(U.begin(),U.end());
  cout << (-1)*U.at(0) << endl;
}

Measured memory_bytes: 4052
#include <iostream>
#include <vector>

using namespace std;


long long N, Q;
long  long ans[200001];
bool visited[200001];
vector<int> T[200001];


void dfs(int r, long long p){
    visited[r] = true;
    ans[r] = p;
    for(int i = 0; i < T[r].size(); i++){
        int to = T[r][i];
        if(visited[to] == false){
            dfs(to, ans[r]+ans[to]);
        }
    }
}


int main(){
    cin >> N >> Q;
    for(int i = 0; i < N-1; i++){
        int a, b;
        cin >> a >> b;
        a --; b --;
        T[a].push_back(b);
        T[b].push_back(a);
    }

    for(int i = 0; i < Q; i++){
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }

    dfs(0, ans[0]);


    for(int i = 0; i < N; i++){
        if(i != N-1){
            cout << ans[i] << " ";
        }else{
            cout << ans[i] << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 24448
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

sat = sum(B)

for i in range(N-1):
    if A[i] == A[i+1] - 1:
        sat += C[A[i]-1]

print(sat)


Measured memory_bytes: 3060
from collections import deque

h,w = map(int,input().split())
A = []
for i in range(h):
    A += list(input())

queue = deque([])
Distance = [-1]*(h*w)

for i in range(h):
    for j in range(w):
        if A[i*w+j]=='#':
            queue.append([i,j])
            Distance[i*w+j] = 0

ans = 0

while queue:
    x,y = queue.popleft()
    d = Distance[x*w+y]
    if x!=0 and Distance[(x-1)*w+y] == -1:
            queue.append([x-1,y])
            ans = Distance[(x-1)*w+y] = d+1
    if x!=h-1 and Distance[(x+1)*w+y] == -1:
            queue.append([x+1,y])
            ans = Distance[(x+1)*w+y] = d+1
    if y!=0 and Distance[x*w+y-1] == -1:
            queue.append([x,y-1])
            ans = Distance[x*w+y-1] = d+1
    if y!=w-1 and Distance[x*w+y+1] == -1:
            queue.append([x,y+1])
            ans = Distance[x*w+y+1] = d+1

print(ans)

Measured memory_bytes: 180220
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  const N = readln.chomp.to!int;
  
  void solve() {
    void dfs(string s, char mx) {
      if (s.length == N) {
        s.writeln;
        return;
      }

      for(char c = 'a'; c <= mx; c++) {
        dfs(s ~ c, c == mx ? cast(char)(mx + 1) : mx);
      }
    }

    dfs("", 'a');
  }

  solve();
}


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


def lcd(a, b):
    return a*b // gcd(a, b)


a, b, c, d = map(int, input().split())

higher = b//c + b//d - b//lcd(c, d)
lower = (a-1)//c + (a-1)//d - (a-1)//lcd(c, d)

print((b-a+1)-higher+lower)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ans = c;
        if (a - b > 0) {
            ans = c - (a - b);
        }
        if (ans < 0) {
            ans = 0;
        }
        System.out.println(ans);
        sc.close();
    }
}

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

using namespace std;

using ll = long long;
const int MOD = 1000000007;
const int MAXN = 2000020;

int fact[MAXN];
int ifact[MAXN];

void precalc() {
   fact[0] = 1;
   for (int i = 1; i < MAXN; ++i) fact[i] = ll(fact[i - 1]) * i % MOD;
   ifact[MAXN - 1] = [&]() {
      int ans = 1;
      int x = fact[MAXN - 1], y = MOD - 2;
      for (; y > 0; y >>= 1, x = ll(x) * x % MOD) {
         if (y & 1) ans = ll(ans) * x % MOD;
      }
      return ans;
   }();
   for (int i = MAXN - 1; i > 0; --i) {
      ifact[i - 1] = ll(ifact[i]) * i % MOD;
   }
   for (int i = 0; i < MAXN; ++i) {
      assert(ll(fact[i]) * ifact[i] % MOD == 1);
   }
}

int ways(int x, int y) {
   return ll(fact[x + y]) * ifact[x] % MOD * ifact[y] % MOD;
}

int get(int x0, int y0, int x1, int y1) {
   int ans = ways(x1 + 1, y1 + 1);
   ans += ways(x0, y0);
   if (ans >= MOD) ans -= MOD;
   ans -= ways(x1 + 1, y0);
   if (ans < 0) ans += MOD;
   ans -= ways(x0, y1 + 1);
   if (ans < 0) ans += MOD;
   return ans;
}

int main() {
   ios_base::sync_with_stdio(false);
   precalc();
   int x0, x1, x2, x3, x4, x5;
   int y0, y1, y2, y3, y4, y5;
   cin >> x0 >> x1 >> x2 >> x3 >> x4 >> x5;
   cin >> y0 >> y1 >> y2 >> y3 >> y4 >> y5;
   int ans = 0;
   for (int x = x2; x <= x3; ++x) {
      ans -= ll(x + y2 - 1) * get(x - x1, y2 - y1 - 1, x - x0, y2 - y0 - 1) % MOD * get(x4 - x, y4 - y2, x5 - x, y5 - y2) % MOD;
      if (ans < 0) ans += MOD;
   }
   for (int y = y2; y <= y3; ++y) {      ans -= ll(x2 + y - 1) * get(x2 - x1 - 1, y - y1, x2 - x0 - 1, y - y0) % MOD * get(x4 - x2, y4 - y, x5 - x2, y5 - y) % MOD;
      if (ans < 0) ans += MOD;
   }
   for (int x = x2; x <= x3; ++x) {
      ans += ll(x + y3) * get(x - x1, y3 - y1, x - x0, y3 - y0) % MOD * get(x4 - x, y4 - y3 - 1, x5 - x, y5 - y3 - 1) % MOD;
      if (ans >= MOD) ans -= MOD;
   }
   for (int y = y2; y <= y3; ++y) {
      ans += ll(x3 + y) * get(x3 - x1, y - y1, x3 - x0, y - y0) % MOD * get(x4 - x3 - 1, y4 - y, x5 - x3 - 1, y5 - y) % MOD;
      if (ans >= MOD) ans -= MOD;
   }
   cout << ans << "\n";
   return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    int a[M];
    bool v[N+1];
    rep(i, N+1){
        v[i] = true; 
    }
    rep(i, M){
        cin >> a[i];
        v[a[i]] = false;
    }
    
    ll dp[N+1] = {};
    dp[0] = 1;
    if(v[1]){
        dp[1] = 1;
    }else{ 
        dp[1] = 0;
    }

    for(int i=2;i<=N;i++){
        if(v[i]){
            dp[i] = (dp[i-1] % MOD) + (dp[i-2] % MOD);
        }else{
            dp[i] = 0;
        }
    }
    // rep(i, N+1){
    //     printf("%d\n", dp[i]);
    // }
    // printf("%d\n", dp[N]);
    printf("%d\n", dp[N] % MOD);
    return 0;
}

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

vector<long long> in(3000);
long long tb[3000][3000][2];
bool valid[3000][3000][2];

long long dp(int i, int j, bool turn){
	if(i == j){
		if(!turn) return in[i];
		else return -in[i];
	}
	
	if(valid[i][j][turn]) return tb[i][j][turn];
	
	valid[i][j][turn] = true;
	if(!turn) return tb[i][j][turn] = max(dp(i+1, j, !turn) + in[i], dp(i, j-1, !turn) + in[j]);
	else return tb[i][j][turn] = min(dp(i+1, j, !turn) - in[i], dp(i, j-1, !turn) - in[j]);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	
	for(int i = 0; i < n; ++i){
		cin >> in[i];
	}
	
	cout << dp(0,n-1, 0) << endl;
	
	return 0;
}

Measured memory_bytes: 158208
gp1 = [1,3,5,7,8,10,12]
gp2 = [4,6,9,11]
gp3 = [2]
x,y = [int(i) for i in input().split()]

if ((x in gp1 and y in gp1) or (x in gp2 and y in gp2) or(x in gp3 and y in gp3)) :
    print("Yes")
else :
    print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int m,n,aa[110000],cnt=0;
pair<int,int> p[220000];
string s,ss[220000],x;
char c;
signed main(){
    cin>>n;
    cout<<(n+1)/2;
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

struct edge {
	int to, id;
};


int N, M, D[100000], dist[200000], uf[100000], col[100000];
vector<edge>e[100000];
vector<pair<int, int>>pp;
vector<int>a[100000];

int par(int x) {
	if (uf[x] == x)return x;
	return uf[x] = par(uf[x]);
}

void uni(int x, int y) {
	x = par(x);
	y = par(y);
	uf[x] = y;
	if (col[y] == -1) {
		col[y] = col[x];
	}
}

void dfs(int x, int from) {
	for (int i : a[x]) {
		if (i == from)continue;
		col[i] = (col[x] ^ 1);
		dfs(i, x);
	}
}

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> D[i];
		uf[i] = i;
		col[i] = -1;
	}
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		e[u].push_back({ v,i });
		e[v].push_back({ u,i });
	}
	for (int i = 0; i < N; i++) {
		bool f = false;
		for (int j = 0; j < e[i].size(); j++) {
			if (D[e[i][j].to] < D[i]) {
				f = true;
				dist[e[i][j].id] = D[i] - D[e[i][j].to];
				uni(e[i][j].to, i);
				break;
			}
		}
		if (!f) {
			for (int j = 0; j < e[i].size(); j++) {
				if (D[e[i][j].to] == D[i]) {
					f = true;
					dist[e[i][j].id] = D[i];
					pp.push_back({ i,e[i][j].to });
					break;
				}
			}
		}
		if (!f) {
			cout << -1 << endl;
			return 0;
		}
	}
	for (auto at : pp) {
		a[par(at.first)].push_back(par(at.second));
		a[par(at.second)].push_back(par(at.first));
	}
	for (int i = 0; i < N; i++) {
		if (col[par(i)] == -1) {
			col[par(i)] = 1;
			dfs(par(i), -1);
		}
	}
	for (int i = 0; i < N; i++) {
		cout << (col[par(i)] ? 'W' : 'B');
	}
	cout << endl;
	for (int i = 0; i < M; i++) {
		if (!dist[i])dist[i] = 1000000000;
		cout << dist[i] << endl;
	}
}

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

int main() {
  int N, K, x, sum;
  cin >> N >> K;
 
  for(int i=0; i<N; i++) {
    cin >> x;
    if(K-x<x)
      sum += 2*(K-x);
    else
      sum += 2*x;
  }
  
  cout << sum << endl;
}

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

using namespace std;

int n;

void solve(string s,char now)
{
    if((int)s.size()==n)
    {
        cout << s << "\n";
        return;
    }
    for(char a='a';a<=now;a++)
    {
        s+=a;
        solve(s,now);
        s.pop_back();
    }
    if(s.size()>=1)
    {
        s+=(now+1);
        solve(s,now+1);
        s.pop_back();
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    solve("",'a');
    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

#define MAX 1010
int N;
ll X[MAX], Y[MAX];

#define PLUS true
#define MINUS false

void compute() {
  int type = ( llabs(X[0]) + llabs(Y[0]) ) & 1;
  REP(i,1,N) if( type != ( ( llabs(X[i]) + llabs(Y[i]) ) & 1 ) ) {
    puts("-1");
    return;
  }
  vector<ll> d;
  rep(i,39) d.push_back(1LL<<i);
  reverse(ALL(d));
  if( type == 0 ) d.push_back(1);
  cout << d.size() << endl;
  rep(i,(int)d.size()) {
    if( i ) printf(" ");
    cout << d[i];
  } puts("");
  rep(i,N) {
    ll u = X[i] + Y[i], v = X[i] - Y[i];
    ll x = 0, y = 0;
    rep(j,(int)d.size()) {
      bool sig1,sig2;
      if( u >= x ) sig1 = PLUS, x += d[j];
      else         sig1 = MINUS,x -= d[j];
      if( v >= y ) sig2 = PLUS, y += d[j];
      else         sig2 = MINUS,y -= d[j];

      if( sig1 == MINUS      && sig2 == MINUS ) cout << "L";
      else if( sig1 == PLUS  && sig2 == PLUS  ) cout << "R";
      else if( sig1 == MINUS && sig2 == PLUS  ) cout << "D";
      else if( sig1 == PLUS  && sig2 == MINUS ) cout << "U";
    }
    puts("");
  }

}

int main() {
  cin >> N;
  rep(i,N) cin >> X[i] >> Y[i];
  compute();
  return 0;
}


Measured memory_bytes: 256
N = int(input())
arr = list(map(int, input().split()))
four_count = 0
two_count = 0
for i in arr:
    if i % 4 == 0:
        four_count += 1
        continue
    if i % 2 == 0:
        two_count += 1
if 0 < four_count:
    N -= four_count * 2
if N <= 1:
    print('Yes')
    exit()
if N <= two_count:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 15020
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	int N; cin >> N;
	map<int, int> mp;
	vector<bool> v(N+1);
	vector<int> p(N);
	rep(i, N) cin >> p[i];

	int ans = 0;
	rep(i, N){
		if(v[p[i]-1]){
			int tmp = 0;
			if(mp.find(p[i]-1) != mp.end()) tmp = mp[p[i]-1];
			mp[p[i]] = tmp + 1;
			chmax(ans, tmp + 1);
		}
		v[p[i]] = true;
	}

	cout << N - (ans + 1) << endl;

	return 0;
}


Measured memory_bytes: 13488
import java.text.MessageFormat;
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();

	}
}


class Solve{


	 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 double N = sc.nextInt();
		 double K = sc.nextInt();
		 double n=0d;
		 double res=0d;


		 String message;


		 for(double i = 1;i<=N;i++) {

			 for(int j = 0;j<100000;j++) {//jに何回2をかけるとKを超えるか
				 if(i*Math.pow(2, j)>=K) {
					 n=j;
					 j=100000;
				 }
			 }
			 res+=1/(N*Math.pow(2, n));//確率計算

		 }
			 message = MessageFormat.format("{0,number,0.000000000000} ", res);

			 System.out.println(message);


		 }
}

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

namespace cysharp_test
{
    class Program
    {
        static void Main (string[] args)
        {
            new Program ().solve ();
        }

        void solve ()
        {
            int N = int.Parse(Console.ReadLine());
            Console.WriteLine((double)N * 2.000000 * 3.141592);
        }

    }

    class Vector2
    {
        public Vector2 (long x, long y)
        {
            this.x = x;
            this.y = y;
        }

        long x, y;

        public static Vector2 operator + (Vector2 a, Vector2 b)
        {
            return new Vector2 (a.x + b.x, a.y + b.y);
        }

        public static Vector2 operator - (Vector2 a, Vector2 b)
        {
            return new Vector2 (a.x - b.x, a.y - b.y);
        }

        public static Vector2 operator * (Vector2 a, long scala)
        {
            return new Vector2 (a.x * scala, a.y + scala);
        }
    }
}

Measured memory_bytes: 27612
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

int main(){
    int n,k; scanf("%d %d", &n, &k);
    ll res = (ll)k; REP(i,2,n) res *= (ll)(k-1);
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 256
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    it = map(int, sys.stdin.read().split())
    D = next(it)
    C = [next(it) for i in range(26)]
    S = [[next(it) for i in range(26)] for i in range(D)]

    ans = []
    for i in range(D):
        ss = S[i]
        di, qi = 0, ss[0]
        for j in range(1, 26):
            if ss[j] > qi:
                di, qi = j, ss[j]
        ans.append(di+1)

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 68480
#include <iostream>
#include <sstream>
#include <bitset>
#include <cmath>
#include <vector>
#include <memory>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ulong = unsigned long;
using ushort = unsigned short;
using uchar = unsigned char;

int main() {
#ifdef __TEST_CODE
    // A dumb way of inlining test cases
    stringstream input_s(
            ""
    );
    stringstream output_s;

    string expected_out("6\n"
    );
    expected_out += "\n";
    istream &in = input_s;
    ostream &out = output_s;
#else
    istream& in = cin;
        ostream& out = cout;
#endif


    string input;
    in >> input;
    string result = "No";
    for (auto& chr : input) {
        if (chr == '7') {
            result = "Yes";
            break;
        }
    }

    out << result << endl;


#ifdef __TEST_CODE
    string actual_out = output_s.str();
    cout << actual_out;
    cout << "Output correct: " << (expected_out == actual_out) << endl;
#endif
    return 0;
}


Measured memory_bytes: 3624
object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)

    val n = scanner.nextInt
    val a = Array.fill(n)(scanner.nextInt)
    println(a.mkString(" "))

    for(i <- 1 until n) {
      val v = a(i)
      var j = i - 1
      while(j >= 0 && a(j) > v) {
        a(j + 1) = a(j)
        j = j - 1
      }
      a(j + 1) = v
      println(a.mkString(" "))
    }
  }
}



Measured memory_bytes: 47312
import java.util.*;
import java.io.*;

public class Main {

  private static void solve() {
    int n = nextInt();
    int K = nextInt();
    int[] h = new int[n];

    for (int i = 0; i < n; i++) {
      h[i] = nextInt();
    }

    int[] dp = new int[n];

    Arrays.fill(dp, Integer.MAX_VALUE);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
      for (int k = 1; k <= K; k++) {
        if (i + k < n) {
          dp[i + k] = Math.min(dp[i + k], dp[i] + Math.abs(h[i + k] - h[i]));
        }
      }
    }

    System.out.println(dp[n - 1]);
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

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

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

  public static void main(String[] args) {
    run();
  }
}

Measured memory_bytes: 36532
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    // train[i]:左端が街i以東であるような電車のリスト、入ってるのは終点の街
    vector<vector<int>> train(n);
    int l, r;
    for (int i = 0; i < m; i++) {
        cin >> l >> r;
        for (int j = 0; j < l; j++) {
            train[j].push_back(r - 1);
        }
    }
    vector<int> x(q), y(q);
    for (int i = 0; i < q; i++) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    //二分探索用にtrain[i]をソート
    for (int i = 0; i < n; i++) {
        sort(all(train[i]));
    }
    for (int i = 0; i < q; i++) {
        auto itr = upper_bound(all(train[x[i]]), y[i]);
        cout << itr - train[x[i]].begin() << endl;
    }
    return 0;
}

Measured memory_bytes: 145132
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Collection;
import java.util.Set;
import java.io.IOException;
import java.util.stream.Collectors;
import java.io.InputStreamReader;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            String S = in.next();

            int max = 0;
            for (int i = 1; i < N - 1; i++) {
                String l = S.substring(0, i);
                String r = S.substring(i);
                Set<Character> l1 = l.chars().mapToObj(c -> (char) c).collect(Collectors.toSet());
                Set<Character> l2 = r.chars().mapToObj(c -> (char) c).collect(Collectors.toSet());
                max = (int) Math.max(max, l1.stream().filter(l2::contains).count());
            }
            out.println(max);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}



Measured memory_bytes: 27476
S=input()
mem_mod = [0 for i in range(0,2019,1)]
N = len(S)
counter = 0
S_num_tmp = list(S)
S_num = list(map(int, S_num_tmp))
tmp=10

for i in range(1,N,1):
    S_num[N-i-1] = S_num[N-i] + S_num[N-i-1]*pow(10,i,2019)

for i in range(0,N,1):
    X = S_num[N-i-1] % 2019
    if X==0:
        counter+=1
    counter += mem_mod[X]
    mem_mod[X] += 1
print(counter)

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

int main() {
  int N,K; cin >> N >> K;
  long ans = 15000000000;
  vector<long> a(N);
  for (int i =0; i<N; i++) cin >> a[i]; 
  vector<long> maxA(N); maxA[0] = a[0];
  for (int i =1; i<N; i++)  
    maxA[i] = max(a[i-1],maxA[i-1]);
  
  for (int i =0; i< (1<<(N-1)); i++) {
    bitset<14> bit(i);
    long count =0;
    if (bit.count() == K-1) {
      long tmp = a[0]; int k =0; 
      for (int j =0; j<N-1; j++) {
        if (bit.test(j)) {
          k++;
          tmp = max(tmp,maxA[j+1]);
          if (a[j+1] - tmp <= 0) {
            count += tmp - a[j+1] + 1;
            tmp = tmp + 1;
          } else {
            tmp = a[j+1];
          }
          if (k == K) break;
        }
      }
      ans = min(count,ans);
    }
  }
  cout << ans << endl;  
}

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

namespace ABC126A
{
    class Program
    {
        static void Main(string[] args)
        {
            var nums = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            var input = Console.ReadLine();

            Console.Write(input.Take(nums[1] - 1).ToArray());
            Console.Write(char.ToLower(input[nums[1] - 1]));
            Console.WriteLine(input.Skip(nums[1]).ToArray());
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define MOD 1000000007
using namespace std;


int main(){
    int N,Y;
    cin >> N >> Y;
    for (int i = 0; i <= N; i++)//10000
    {
        for (int j = 0; j <= N - i; j++)//5000
        {
            if(10000 * i + 5000 * j + 1000 * (N-i-j) == Y){
                cout << i << " " << j << " " << N-i-j << endl;
                return 0;
            }
        }
        
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int get_weekday(int y, int m, int d) {
    int n, tmp;
    if(m==1||m==2) {
        y--;
        m+=12;
    }
    tmp = y/100;
    n = (y+(y>>2)-tmp+(tmp>>2) + (13*m+8)/5+d)%7;
    return n;
}

int main()
{
    int a, b;
    while(true) {
        cin >> a >> b;
        if (a==0&&b==0) break;

        int n = get_weekday(2004, a, b);
        switch (n) {
            case 0:
                P("Sunday");
                break;
            case 1:
                P("Monday");
                break;
            case 2:
                P("Tuesday");
                break;
            case 3:
                P("Wednesday");
                break;
            case 4:
                P("Thursday");
                break;
            case 5:
                P("Friday");
                break;
            case 6:
                P("Saturday");
                break;
        }
    }
    return 0;
}

Measured memory_bytes: 3004
#include <iostream>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    while(!(x==0 && y==0))
    {
        if(x<y)
            cout<<x<<" "<<y<<endl;
        else
            cout<<y<<" "<<x<<endl;
        cin>>x>>y;
    }
    return 0;
}


Measured memory_bytes: 3052
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

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

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

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

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7') {
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}


Measured memory_bytes: 3652
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		int[] ex = new int[26];
		int index = 0;
		for(int i = 0; i < S.length(); i++){
			int c = S.charAt(i) - 'a';
			//System.out.println(c);
			ex[c] = 1;
		}
		
		for(int i = 0; i < ex.length; i++){
			if(ex[i] == 0){
				char c = (char)('a' + i);
				System.out.println(c);
				return;
			}
		}
		System.out.println("None");
	}
}

Measured memory_bytes: 24100
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
using namespace std;


int main()
{
	int n, l;
	cin >> n >> l;
	string con = {""};
	vector<string>s(n);
	for (int i = 0; i < n; i++)cin >> s[i];
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++) {
		con += s[i];
	}
	cout << con << endl;
}



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

using namespace std;

void Task() {
      int n;
      string s;
      cin >> n >> s;
      string shift;
      for (char ch = 'A'; ch <= 'Z'; ch++) {
            shift.push_back(ch);
      }
      shift += shift;
      string ans;
      for (int i = 0; i < s.size(); i++) {
            int val = s[i] - 'A';
            int pos = val + n;
            char ch = shift[pos];
            ans.push_back(ch);
      }
      cout << ans << endl;
}

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

      if (fopen("in.txt", "r")) {
            freopen("in.txt", "r", stdin);
      }

      int tc = 1;
      while (tc--) {
            Task();
      }
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int r,d;
    long long int x;
    cin >> r >> d >> x;
    for(int i = 0;i < 10;i++)
    {
        x = r * x - d;
        cout << x << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static long solve(int N, int[] a) {
        long[] score = new long[N+1];

        for (int e = 0; e < N; e++)
            for (int s = e; s >= 0; s--)
                score[s] = Math.max(a[s] - score[s+1], a[e] - score[s]);         

        return score[0];
    }

    public static long run(Scanner scanner) {
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i=0; i < N; i++) a[i] = scanner.nextInt();

        return solve(N, a);
    }

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            System.out.println(run(scanner));
        }
        //Tests.run();
    }
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

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

	queue<pint> que; que.push({0, -1});
	vector<bool> visit(N, 0);
	visit[0] = 1;
	vint ans(N);
	while(!que.empty()){
		pint p = que.front(); que.pop();
		int pos = p.first;
		ans[pos] = p.second+1;
		for(int nx: G[pos]){
			if(!visit[nx]){
				visit[nx] = 1;
				que.push({nx, pos});
			}
		}
	}

	cout << "Yes" << ln;
	RANGE(i, 1, N){
		cout << ans[i] << ln;
	}
}

Measured memory_bytes: 10660
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define iss istringstream
#define sst stringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sh(i) (1LL<<i)
#define sz size()
#define vi vector<int>
#define vc vector
#define vl vector<ll>
#define vs vector<string>

char a='a',b='a',c='a';
string s;
set<string> S;

int main(){
	while(1){
		printf("?%c%c%ca\n",a,b,c);
		string t="";
		t+=a,t+=b,t+=c,t+='a';
		S.insert(t);
		cin>>s;
		if(s[0]!='a'||S.count(s)){
			cout<<"!OUT\n";//printf("!OUT\n");
			return 0;
		}
		S.insert(s);
		a=s[s.sz-1];
		c++;
		if(c=='{')b++,c='a';
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <cmath>
#include <chrono>
#include <iomanip>
using namespace std;
using namespace std::chrono;
#define sL(i) i << 1
#define sR(i) i << 1 | 1
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>, int> ppi;
typedef pair<string, string> ps;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;

int N; 
ll ans = 0;
string S;
map<ps, int> um;

void solve(string s, bool calc = false){
    for (int i = 0; i < (1<<N); i++) {
        string red = "";
        string blue = "";
        for (int j = 0; j < N; j++) {
            if (i & (1<<j)) red += s[j];
            else blue += s[j];
        }
        reverse(blue.begin(), blue.end());
        if (calc) {
            ps x = {blue, red};
            auto it = um.find(x);
            if (it != um.end()) ans += it->second;
        } else {
            ps x = {red, blue};
            um[x]++;
        }
    }
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    high_resolution_clock::time_point t1 = high_resolution_clock::now();
    cin >> N >> S;
    solve(S.substr(N));
    solve(S.substr(0, N), true);
    cout << ans;
    high_resolution_clock::time_point t2 = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(t2 - t1).count();
    // cout << "\n";
    // cout << "Ran in " << duration / 1000 << "ms";
}   

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

class Progaram
{
    static void Main(string[] args)
    {
        var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var n = l[0]; var m = l[1]; var c = l[2];
        var b = Console.ReadLine().Split(' ').Select(f => int.Parse(f)).ToArray();

        var res = 0;
        int[] a;
        int num;
        for (var i = 0; n > i; i++)
        {
            num = 0;
            a = Console.ReadLine().Split(' ').Select(j => int.Parse(j)).ToArray();
            for (var j = 0; m > j; j++)
            {
                num += a[j] * b[j];
            }
            num += c;
            if (num > 0) res++;
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 13268
/*****include*****/
#include <iostream>
#include <fstream>
#include <string>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int n;
	long int *numbers;
	long int sum;
	long int max_sum;
	/*****処理部*****/
	while(1){
		cin >> n;
		if(n == 0)	break;
		numbers = new long int [n];
		cin >> numbers[0];
		max_sum = numbers[0];
		for(int i=1;i<n;i++){
			cin >> numbers[i];
			sum = 0;
			for(int j=i;j>=0;j--){
				sum += numbers[j];
				if(sum > max_sum)	max_sum = sum;
			}
		}
		cout << max_sum << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

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

int main(void){
    ll x,y;
    cin>>x>>y;
    if(x%y==0)cout<<-1<<endl;
    else {
        ll res = x;
        while(res%y==0) res += x;
        cout<<res<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using lint = long long;

void solve() {
    lint a, b, c;
    std::cin >> a >> b >> c;

    lint lhs = a * b * 4;
    lint rhs = c - a - b;
    bool out = rhs < 0;
    rhs *= rhs;
    std::cout << (!out && lhs < rhs ? "Yes" : "No") << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
N=int(input())
#m1,d1=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
S=list(input())
d=list('0123456789')
ans=0
for d1 in d:
    for d2 in d:
        for d3 in d:
            v=d1+d2+d3
            i=0
            p=0
            while i < N :
                if v[p]==S[i]:
                    p+=1
                    if p == 3:
                        break
                i+=1
            if p==3 :
                ans+=1
print(ans)

Measured memory_bytes: 71244
//aising2020_d.cpp
//Sat Jul 11 20:50:48 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

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

	ll defpop = 0;
	vector<ll> keta;
	rep(i,n){
		ll a = s[i]-'0';
		keta.push_back(a);
		if(keta[i]==1){
			defpop++;
		}
	}

	ll amarip[n];
	ll amarim[n];
	fill(amarip,amarip+n,0);
	fill(amarim,amarim+n,0);
	ll x = 1;
	ll y = 1;
	for (int i=n-1;i>=0;i--){
		amarip[i] = x%(defpop+1);
		x = amarip[i]*2;
		if (defpop-1>0){
			amarim[i] = y%(defpop-1);
			y = amarim[i]*2;
		}
	}

	ll xp = 0;
	rep(i,n){
		xp = (xp*2+keta[i])%(defpop+1);
	}
	ll xm = 0;
	if (defpop-1>0){
		rep(i,n){
			xm = (xm*2+keta[i])%(defpop-1);
		}
	}
	
	rep(i,n){
		ll tmp;
		ll ans = 1;
		if (keta[i]){
			if (defpop-1>0){
				tmp = (xm-amarim[i]+defpop-1)%(defpop-1);
			}else {
				tmp = 0;
				ans = 0;
			}
		}else {
			tmp = (xp+amarip[i])%(defpop+1);
		}
		while(tmp>0){
			ans++;
			ll z = tmp;
			ll popnum = 0;
			ll base = 2;
			while(z>0){
				if (z%2==1){
					popnum++;
				}
				z = z/2;
			}
			tmp = tmp%popnum;
		}
		cout << ans << endl;
	}

}

Measured memory_bytes: 8120
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,D;
    cin >> N >> D;
    int x = D * 2 + 1;
    cout << (N + x - 1) / x << endl;
}

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

int H,W;
string A[101];
#define NO "No"
#define YES "Yes"

string solve(){
    map<char,int> cnt;
    for(int y=0;y<H;y++){
        for(int x=0;x<W;x++){
            cnt[A[y][x]]++;
        }
    }
    if(H%2==0 && W%2==0){
        for(auto &p : cnt){
            if(p.second%4) return NO;
        }
        return YES;
    }
    if(H%2 && W%2){
        map<int,int> c;
        for(auto &p : cnt) c[p.second%4]++;
        if(c[3]) return NO;
        if(c[1]!=1) return NO;
        if(c[2]>(H-1)/2+(W-1)/2) return NO;
        return YES;
    }
    if(W%2) swap(H,W);
    map<int,int> c;
    for(auto &p : cnt) c[p.second%4]++;
    if(c[1]||c[3]) return NO;
    if(c[2]>W/2) return NO;
    return YES;
}

int main(){
    cin>>H>>W;
    for(int y=0;y<H;y++) cin>>A[y];
    cout<<solve()<<endl;
}

Measured memory_bytes: 256
#include <iostream>

int main () {
  int n;
  std::cin >> n;
  for(int i = 1; i < 10; ++i){
    for(int j = 1; j < 10; ++j){
      if(i * j == n) {
        std::cout << "Yes" << std::endl;
        return 0;
      }
    }
  }
  std::cout << "No" << std::endl;
}

Measured memory_bytes: 256