akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<>();

		while(true){

			int num = in.nextInt();
			int sum = in.nextInt();
			int count = 0;

			if(num == 0 && sum == 0){

				break;

			}else{

				for(int f = 1; f <= (num-2); f++){

					for(int s = f; s <= (num-2); s++){

						for(int t = s; t <= (num-2); t++){

							// ??°????¢????
							// String c = f + "+" + (s + 1) + "+" + (t + 2);
							// System.out.println(c);

							if(f + (s + 1) + (t + 2) == sum){

								count++;

							}
						}
					}
				}

				list.add(count);

			}
		}

		for(int result: list){

			System.out.println(result);

		}

	}
}

Measured memory_bytes: 26560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    ll a[n];
    ll ans=0;
    REP(i,n) cin >> a[i];
    REP(i,n-1){
        if(a[i] > a[i+1]){
            ans += (a[i]-a[i+1]);
            a[i+1] = a[i];
        }
    }
    cout << ans << "\n";

    return 0;
}

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

                            typedef long long ll;
                            typedef double ld;
                            #define rep(i,a,n) for(ll i=(a); i<(n); i++)
                            #define per(i,a,n) for(ll i=(n-1); i>=(a); i--)
                            #define F first
                            #define S second
                            #define maxx(a,b) a=max(a,b)
                            #define minn(a,b) a=min(a,b)
                            #define db(x) cerr<<#x<<" = "<<x<<endl
                            #define N 1111111
                            #define mod 1000000007
                            #define rt return
                            #define inf 1000000000

                            using namespace std;

                            vector<int> g[111111];
                            int dp[111111];

                            int dfs(int v)
                            {
                                if(dp[v])rt dp[v];
                                dp[v]=1;
                                for(auto x: g[v])
                                    if(dp[v]<dfs(x)+1)dp[v]=dfs(x)+1;
                                rt dp[v];
                            }

                            int main(){

                                ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

                                //freopen("Ulug'bek","r",stdin);
                                //freopen("Abdimanabov","w",stdout);

                               int n,m; cin>>n>>m;

                               rep(i,0,m)
                               {
                                   int j,k; cin>>j>>k;
                                   g[j].push_back(k);
                               }

                               rep(i,1,n+1)
                               dfs(i);

                               cout<<*max_element(dp+1,dp+n+1)-1;

                            rt 0;
                            }



















Measured memory_bytes: 8448
def prime_factorize(n):
    ans = []
    for i in range(2, int(n ** (1 / 2)) + 1):
        while True:
            if not n % i == 0:
                break
            ans.append(i)
            n /= i
        if n == 1:
            break
    if n != 1:
        ans.append(int(n))
    return ans

def comb(n, r, p):
    x, y = 1, 1
    for i in range(n, n - r, -1):
        x *= i
        y *= i + r - n
        x %= p
        y %= p
    return pow(y, p - 2, p) * x % p

n, m = map(int, input().split())
mod = 10 ** 9 + 7
s = prime_factorize(m)
if m == 1:
    s = [1]
c = 0
d = s[0]
ans = 1
for i in range(len(s)):
    if d == s[i]:
        c += 1
    else:
        d = s[i]
        ans *= comb(n - 1 + c, c, mod)
        ans %= mod
        c = 1
ans *= comb(n - 1 + c, c, mod)
ans %= mod
if m == 1:
    ans = 1
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  cin >> n;

  vector<llong> h(n);
  REP(i,n){
    cin >> h[i];
  }

  llong dp[100001] = {};
  REP(i,100001){
    dp[i] = INF;
  }

  dp[0] = 0;
  REP(i,n){
    dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
  }

  cout << dp[n-1] << endl;
  return 0;
}



Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(void)
{	
	int n;
	cin >> n;
	
	if (n == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int a, b;
		cin >> a >> b;

		cout << a + b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))
l = X[:]

l.sort()

m = (l[N//2 - 1] + l[N//2])/2

for i in range(N):
    if X[i] > m:
        print(l[N//2 - 1])
    else:
        print(l[N//2])


Measured memory_bytes: 26356
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(long long i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    ll n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<ll> score(3);
    score[0] = a;
    score[1] = b;
    score[2] = c;
    vector<string> s(n);
    vector<ll> input(n);
    rep(i, n) {
        cin >> s[i];
        if (s[i]=="AB") input[i] = 2;
        if (s[i]=="AC") input[i] = 1;
        if (s[i]=="BC") input[i] = 0;
    }
    string ans = "Yes";
    vector<char> res(n);

    rep(i, n) {
        int x = input[i];
        int y = (x+1)%3;
        int z = (x+2)%3;
        if (score[y]==0 && score[z]==0) {
            ans = "No";
            break;
        }
        else if (score[y]>score[z]) {
            score[y]--;
            score[z]++;
            res[i] = z;
        }
        else if (score[y]<score[z]) {
            score[y]++;
            score[z]--;
            res[i] = y;
        }
        else if (i==n-1 && score[y]==score[z]) {
            score[y]--;
            score[z]++;
            res[i] = z;
        } 
        else if (i!=n-1 && score[y]==score[z]) {
            int next = input[i+1];
            if (next==x) {
                score[y]++;
                score[z]--;
                res[i] = y;
            }
            else {
                if (next==y) {
                    score[y]--;
                    score[z]++;
                    res[i] = z;
                }
                else {
                    score[y]++;
                    score[z]--;
                    res[i] = y;
                }
            }
        }
    }
        
    cout << ans << endl;
    if (ans=="Yes") {
        rep(i, n) {
            char cc = 'A' + res[i];
            cout << cc << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 7208
#include<bits/stdc++.h>                          
using namespace std;
int n,m,ans;
string s[105],t;
map<string,int>mp;
int main(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>s[i], mp[s[i]]++;
    cin>>m;
    for(int i=0;i<m;i++) cin>>t,mp[t]--;
    for(int i=0;i<n;i++) ans=max(ans,mp[s[i]]);
    cout<<ans;
    return 0;
}
//68871358
//76140264

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
using ll = long long;
int main(){ 
    string s;
    cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy";
    }else if(s=="Cloudy"){
        cout<<"Rainy";
    }else{
        cout<<"Sunny";
    }
    return 0;
}


Measured memory_bytes: 256
import scala.annotation.tailrec
import scala.collection.mutable

object Main extends App {
  import scala.io.StdIn._
  val Array(n, m, p) = readLine.trim.split(' ').map(_.toInt)
  val destination = Array.fill(m){(readInt() + n - p) % n}.sorted
  var min = math.min(n - 1, math.min((n - destination.head), destination.last))
  for (i ← destination.indices.tail) {
    if (min > math.min(destination(i - 1) * 2 + (n - destination(i)), destination(i - 1) + (n - destination(i)) * 2)) {
      min = math.min(destination(i - 1) * 2 + (n - destination(i)), destination(i - 1) + (n - destination(i)) * 2)
    }
  }
  println(min * 100)
}


Measured memory_bytes: 50424
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _008_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int[] xy = ReadInts();
            int x = xy[0];
            int y = xy[1];
            if (x == y)
            {
                Console.WriteLine(0);
                return;
            }
            int res = 0;
            bool increase = Math.Abs(y) > Math.Abs(x);
            if (increase && x < 0) res++;
            else if (!increase && x > 0) res++;
            res += Math.Abs(Math.Abs(y) - Math.Abs(x));
            if (increase && y < 0) res++;
            else if (!increase && y > 0) res++;
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        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: 11220
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

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

using namespace std;
using ll = long long;

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

    map<string, int> mp;
    mp["SUN"] = 7;
    mp["MON"] = 6;
    mp["TUE"] = 5;
    mp["WED"] = 4;
    mp["THU"] = 3;
    mp["FRI"] = 2;
    mp["SAT"] = 1;

    cout << mp[S] << endl;
    return 0;
}


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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

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

    vector<i64> z(n), w(n);
    for (int i = 0; i < n; i++)
    {
        i64 x, y;
        cin >> x >> y;
        z[i] = x + y;
        w[i] = x - y;
    }

    i64 zmax = accumulate(z.begin(), z.end(), z[0], [](i64 lhs, i64 rhs) -> i64 {
        return max(lhs, rhs);
    });
    i64 zmin = accumulate(z.begin(), z.end(), z[0], [](i64 lhs, i64 rhs) -> i64 {
        return min(lhs, rhs);
    });
    i64 wmax = accumulate(w.begin(), w.end(), w[0], [](i64 lhs, i64 rhs) -> i64 {
        return max(lhs, rhs);
    });
    i64 wmin = accumulate(w.begin(), w.end(), w[0], [](i64 lhs, i64 rhs) -> i64 {
        return min(lhs, rhs);
    });

    cout << max(zmax - zmin, wmax - wmin) << endl;

    return 0;
}

Measured memory_bytes: 6400
#include <iostream>
#include <ostream>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

const int INF = 1000000;

int main() {
	string s;
	cin >> s;
	string r1, r2;
	for (int i = 0; i < s.size(); i++)
	{
		if (i % 2 == 0) {
			r1 += "1";
			r2 += "0";
		}
		else {
			r1 += "0";
			r2 += "1";
		}
	}
	int res1, res2;
	res1 = 0;
	res2 = 0;

	for (int i = 0; i < s.size(); i++)
	{
		if (r1.at(i) != s.at(i)) res1++;
		if (r2.at(i) != s.at(i)) res2++;
	}
	cout << min(res1, res2) << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p.at(i);
    int ans = 0;
    for(int i = 1; i < n-1;i++){
        if(p.at(i-1) > p.at(i) && p.at(i) >= p.at(i+1)){
            ans++;
            continue;
        }
        if(p.at(i+1) > p.at(i) && p.at(i) >= p.at(i-1)){
            ans++;
            continue;
        }
    }
    cout << ans << endl;
}

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

int main() {
  int N, M;
  cin >> N;
  vector<string>s(N);

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

  cin >> M;
  vector<string>t(M);
  for (int i = 0; i < M; i++)
  {
    cin >> t.at(i);
  }

  int ans = 0;
  int score;
  for (int i = 0; i < N; i++)
  {
    score = 0;
    for (int j = 0; j < N; j++)
    {
      if (s.at(i) == s.at(j)) score++;
    }
    
    for (int j = 0; j < M; j++)
    {
      if (s.at(i) == t.at(j)) score--;
    }
    ans = max(ans, score); 
  }
  cout << ans <<endl;
}

Measured memory_bytes: 3616
"""
B - Palace
"""
#入力処理
def simple_input():
    temp_input = input().rstrip().split(' ')
    if len(temp_input) > 1:
        return temp_input
    return temp_input[0]

#メイン処理
if __name__ == '__main__':
    #入力
    n = simple_input()
    t,a = simple_input()
    h = simple_input()
    n = int(n)
    t = int(t)
    a = int(a)
    
    a_min = None
    index = 0

    for i in range(n):
        kion = t - int(h[i]) * 0.006
        t_min = abs(a - kion)
        if(a_min is None or a_min > t_min):
            a_min = t_min
            index = i

    #出力
    print("{0}".format(index+1))


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

#define int long long int
#define mp make_pair
using namespace std;

int32_t main() {
    vector<int> v(4);
    for (int i = 0; i < 4; ++i) {
        scanf("%lld", &v[i]);
    }
    sort(v.begin(), v.end());
    if(v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9){
        printf("YES");
    }
    else{
        printf("NO");
    }
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (replicateM, unless, guard)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List (foldl')
import Data.Vector.Unboxed (Vector, (!), (//))
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  [n, s] <- map read <$> words <$> getLine
  unless (n == 0 && s == 0) $ do
    solve s <$> replicateM n (readi B.readInt <$> B.getLine) >>= print
    main

solve :: Int -> [Int] -> Int
solve s xs = s1 + s2
  where c = foldl' (\v x -> V.accum (+) v [(x,1)]) (V.replicate 101 0) xs :: Vector Int
        s1 = sum . map (\i -> let ci = (c ! i)  in ci * (ci-1) `div` 2) $ [(s `div` 2 + 1) ..100]
        s2 = sum $ do
          i <- [1..99]
          j <- [i+1 .. 100]
          guard $ i + j > s
          return $ (c ! i) * (c ! j)

readi :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> a
readi f s = let Just (n, _) = f s in n



Measured memory_bytes: 8740
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long ll;
struct edge{
  int from,to,cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;
typedef pair<int , int> P;
bool comp(const edge& e1, const edge& e2){
  return e1.cost < e2.cost;
}

long long int MOD = 1000000007;
long long int ruiseki[200001];
void ncrset(){
  ruiseki[0] = 1;
  for(int i=1;i<200001;i++){
    ruiseki[i] = (ruiseki[i-1] * i) % MOD;
  }
}

long long int powld(long long int x,long long int n,long long int mod){
  long long int ans = 1;
  while(n > 0){
    if((n&1) == 1){
      ans = (ans*x)  % mod;
    }
    x = (x*x) % mod;
    n >>= 1;
  }
  return ans % mod;
}


int main()
{
  ll N,K,A[100001],res=0;
  cin >> N;
  REP(i,N)cin >> A[i];
  ll sum[100001];
  sum[0] = 0;
  sum[1] = 1;
  for(int i=2;i<=100000;i++){
    sum[i] = (sum[i-1] + powld(i,MOD-2,MOD))%MOD;
  }
 
  ncrset();
  for(int i=1;i<=N;i++){
    res = ((res + (((((ruiseki[N]*(sum[N-i+1]-1))%MOD + ((sum[i])*ruiseki[N])%MOD))%MOD)*A[i-1])%MOD))%MOD;
  }
  cout << res << endl;
  
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}



Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define F first
#define S second 
#define pb(n) push_back(n)
const int N=1e5+6;
const ll M=1e9+7;
vector<int> g[N];

int main()
{
	int n,k,x;
	scn(n);scn(k);
	set<int> st;
	for(int i=0;i<n;i++)
	{
		scn(x);
		st.insert(x);
	}
	int dp[k+1]={0};
	for(int i=1;i<=k;i++)
	{
		if(st.find(i)==st.end())
		{
			int ok=1;
			for(int it:st)
			{
				if(it>i)
					break;
				if(dp[i-it]==1)
				{
					ok=0;
					break;
				}
			}
			dp[i]=ok;
		}
	}
	if(dp[k])
		printf("Second\n");
	else printf("First\n");
}

Measured memory_bytes: 2944
import math

A, B, H, M = map(int, input().split())
angleA = 30 * H + 30 / 60 * M
angleB = 360 / 60 * M
x = abs(angleA - angleB)
if x > 180:
    x = 360 - x
l = math.sqrt(A * A + B * B - 2 * A * B * math.cos(math.radians(x)))
print(l)


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,A,B;
  cin>>N>>A>>B;
  ll ans=0;
  for(int i=0;i<=N;i++){
    int res=0;
    int n=i;
    for(int i=0;i<5;i++){
      res+=(n%10);
      n/=10;
    }
    if(A<=res&&res<=B)ans+=i;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np

n = int(input())
a = map(int, input().split())

a = np.array(list(a)).astype(np.float)
c = np.zeros(n)
c[0] = 1 / 2
c[-1] = 1 / 2


ans = np.round(np.real(np.fft.ifft(np.fft.fft(a) / np.fft.fft(c)))).astype(np.int)

print(*ans)


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

int main(void)
{
	int N;
	int M, P, p[101][101];
	int K, L, l[101];
	int no;
	int i, j;

	while (1){
		scanf("%d", &N);
		if (N == 0){
			break;
		}
		
		memset(p, 0, sizeof(p));
		for (i = 1; i <= N; i++){
			scanf("%d", &M);
			for (j = 0; j < M; j++){
				scanf("%d", &P);
				p[i][P] = 1;
			}
		}

		memset(l, 0, sizeof(l));
		scanf("%d", &K);
		for (i = 1; i <= K; i++){
			scanf("%d", &L);
			l[L] = 1;
		}
		no = 0;
		for (i = 1; i <= N; i++){
			for (j = 1; j <= N; j++){
				if (l[j] == 1){
					if (p[i][j] != 1){
						break;
					}
				}
			}
			if (j == N + 1){
//printf("[%d]", i);
				if (no == 0){
					no = i;
				}
				else {
					printf("-1\n");
					break;
				}
			}
		}
		if (i == N + 1){
			if (no != 0){
				printf("%d\n", no);
			}
			else {
				printf("-1\n");
			}
		}
	}
	return (0);
}

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

int main() {
	string inputT;
	string outputT;
	string data;
	data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	outputT = "";
	cin >> inputT;

	for (int i = 0; i < inputT.size(); i++) {
		for (int j = 0; j < 26; j++) {
			if (inputT[i] == data[j] && j >= 3) {
				outputT.push_back(data[j - 3]);
			}
			if (inputT[i] == data[j] && j == 0) {
				outputT.push_back(data[23]);
			}
			if (inputT[i] == data[j] && j == 1) {
				outputT.push_back(data[24]);
			}
			if (inputT[i] == data[j] && j == 2) {
				outputT.push_back(data[25]);
			}
		}
	}

	cout << outputT << endl;
	//cout << data[25];
}


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

using namespace std;
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(10000000); //n!(mod M)
vector<ll> ifac(10000000); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main()
{
    ll x,y;
    cin >> x >> y;
    ll stant;
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<10000000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    int check = (x + y) % 3;
    stant = (x + y) / 3;
    x -= stant;
    y -= stant;
    if (x < 0 || y < 0 || check != 0) {
        cout << 0 << endl;
        return 0;
    } else {
        ll ans=0;
        ans = comb(x+y, x)%M;
        cout << ans << endl;
        return 0;
    }
}

Measured memory_bytes: 156672
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Sample
{
  class Sample
  {
    static void Main()
    {
      var p = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
      if(p[0] == p[1]&&p[1] == p[2]&&p[0] == p[2]){
      Console.Write("No");
      }else if(p[0] != p[1]&&p[1] != p[2]&&p[0] != p[2]){
            Console.Write("No");

      
      }else{
                  Console.Write("Yes");

      
      }
      
      
		}
	}
}

Measured memory_bytes: 13140
object Main extends App {
  val in = io.StdIn.readLine.split(' ').map(_.toInt)

  val A = in(0)
  val B = in(1)
  val K = in(2)

  val out = (math.min(A,B) to 1 by -1).filter(i => A % i == 0 && B % i ==0)

  println(out(K-1))
}


Measured memory_bytes: 25300
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int main(void){
    int N, M;
    cin >> N >> M;
    int r[N];
    FOR(i,0,N) r[i] = 0;
    FOR(i,0,M){
        int a, b;
        cin >> a >> b;
        a--;b--;
        r[a]++;
        r[b]++;
    }
    FOR(i,0,N) cout << r[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
const int N = 3e5 + 1;
int n, m, k;
long long int A[N], B[N], cs[N], sum; 
int main(){
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    for(int i = 0; i < m; i++){
        cin >> B[i];
        cs[i + 1] = cs[i] + B[i];
    }
    int answer = upper_bound(cs, cs + m + 1, k) - cs - 1;
    for(int i = 0; i < n; i++){
        sum += A[i];
        if(sum > k)break;
        int value = upper_bound(cs, cs + m + 1, k - sum) - cs - 1;
        answer = max(answer, (i + 1) + value);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 8296
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s, t; cin >> s >> t;
	reverse(ALL(s)); reverse(ALL(t));
	int n = s.size(); int ts = t.size();
	bool now = false;
	rep(i, n - ts + 1) {
		bool ok = true;
		rep(j, ts) {
			if (s[i + j] != '?' && t[j] != s[i + j]) {
				ok = false; break;
			}
		}
		if (ok) {
			rep(j, ts) {
				s[i + j] = t[j];
			}
			now = true;
			break;
		}
	}
	if (!now) {
		cout << "UNRESTORABLE" << endl; return 0;
	}
	rep(i, n) {
		if (s[i] == '?')s[i] = 'a';
	}
	reverse(ALL(s));
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a,b,k;
  cin >> a >> b >> k;
  int cnt = 0;
  for(int i = min(a,b); i>0; --i){
    if(a%i==0 && b%i==0) ++cnt;
    if(cnt==k){
      cout << i << endl;
      break;
    }
  }
}


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

const int limit = 2005;
int U[limit][limit], D[limit][limit], L[limit][limit], R[limit][limit];

int main(void) {
  int H, W;
  cin >> H >> W;
  char S[limit][limit];

  for (int k = 1; k <= H; k++) { scanf("%s", S[k] + 1); }

  for (int k = 1; k <= H; k++) {
    for (int l = 1; l <= W; l++) {
      if (S[k][l] == '.') {
        U[k][l] = U[k-1][l] + 1;
        R[k][l] = R[k][l-1] + 1;
      }
    }
  }

  for (int k = H; k >= 1; k--) {
    for (int l = W; l >= 1; l--) {
      if (S[k][l] == '.') {
        D[k][l] = D[k+1][l] + 1;
        L[k][l] = L[k][l+1] + 1;
      }
    }
  }

  int ans = 0;
  for (int k = 1; k <= H; k++) {
    for (int l = 1; l <= W; l++) {
      ans = max(ans, U[k][l] + D[k][l] + L[k][l] + R[k][l] - 3);
    } 
  }
  
  cout << ans << endl;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    ll x;
    cin >> x;
    int ans = 0;
    ll cur = 100;
    while (cur < x) {
        cur *= 1.01;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()

const int mod = 1e9 + 7;
int block;

typedef struct Query
{
	int l, r, idx;
}query;

bool cmp(query a, query b)
{
	if(a.l/block != b.l/block) return a.l < b.l;
	return a.r < b.r;
}

int main()
{
	fastIO;
	string s; cin >> s;
	int n = s.length();
	if(s[n - 1] == 's') cout << s + "es" << endl;
	else cout << s + "s" << endl;

	return 0;
}

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

int main() {
char b;
cin >> b;
if (b == 'A'){
  cout << 'T' << endl;
}
if (b == 'T'){
  cout << 'A' << endl;
}
if (b == 'G'){
  cout << 'C' << endl;
}
if (b == 'C'){
  cout << 'G' << endl;
}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
  ll N,S,sum=0,mi=MOD;
  cin >> N;
  rep(i,N){
    cin >> S;
    sum+=S;
    if(S%10!=0 && mi>S){
      mi=S;
    }
  }
  if(sum%10!=0){
    cout << sum << endl;
  }
  else if(mi!=MOD){
    cout << sum-mi << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main() {
  int n; cin>>n;
  set<string> st;
  string l; cin>>l; st.insert(l);
  rep(i,n-1){
    string w; cin>>w;
    if(l.back()!=w.front()){ cout << "No" << endl; return 0;}
    l=w;
    if(st.find(w)==st.end()){ st.insert(w); continue; }
    cout << "No" << endl; return 0;
  }

  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int c[3][3],i,j;
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			scanf("%d",&c[i][j]);
		}
	}
	for(i=0;i<2;i++){
		if(c[i][0]-c[i+1][0]==c[i][1]-c[i+1][1]&&c[i][1]-c[i+1][1]==c[i][2]-c[i+1][2]&&c[i][2]-c[i+1][2]==c[i][0]-c[i+1][0]) continue;
		else{
			printf("No\n");
			return 0;
		}
	}
	if(c[2][0]-c[0][0]==c[2][1]-c[0][1]&&c[2][1]-c[0][1]==c[2][2]-c[0][2]&&c[2][2]-c[0][2]==c[2][0]-c[0][0]){
		for(i=0;i<2;i++){
			if(c[0][i]-c[0][i+1]==c[1][i]-c[1][i+1]&&c[1][i]-c[1][i+1]==c[2][i]-c[2][i+1]&&c[2][i]-c[2][i+1]==c[0][i]-c[0][i+1]) continue;
			else{
			printf("No\n");
			return 0;
			}
		}
		if(c[0][2]-c[0][0]==c[1][2]-c[1][0]&&c[1][2]-c[1][0]==c[2][2]-c[2][0]&&c[2][2]-c[2][0]==c[0][2]-c[0][0]) printf("Yes\n");
	}else{
		printf("No\n");
		return 0;
	} 
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, a[200010], b[200010], t;
set<int> st;
vector<int> vec;
vector<int> ve;
ll mi[40];
int d[40];
int ans;

signed main() {
	cin >> n >> t;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		if (a[i])st.insert(i);
	}
	fill(mi + 1, mi + 40, 1000000000000000000);
	for (int i = 1; i <= n; i++) {
		if (t < mi[i - 1])break;
		if (st.empty())break;
		ll mini = 1000000000000000000, p = 0, q = 0;
		auto r = st.begin();
		while (r != st.end()) {
			int x = *r;
			for (int j = 0; j < i; j++) {
				ll ti = d[j];
				ti = (ti + 1)*(a[x] + 1) + b[x];
				for (int k = j; k < i - 1; k++)ti = (ti + 1)*(a[vec[k]] + 1) + b[vec[k]];
				if (ti < mini)mini = ti, p = x, q = j;
			}
			r++;
		}
		mi[i] = mini;
		for (int j = 0; j < q; j++)ve.push_back(vec[j]);
		ve.push_back(p);
		for (int j = q; j < i - 1; j++)ve.push_back(vec[j]);
		vec = ve;
		ve.clear();
		st.erase(p);
		for (int j = 0; j < i; j++)d[j + 1] = (d[j] + 1)*(a[vec[j]] + 1) + b[vec[j]];
	}
	for (int i = 0; i < n; i++)if (a[i] == 0)ve.push_back(b[i]);
	sort(all(ve));
	for (int i = 0;; i++) {
		if (t < mi[i])break;
		int cnt = i;
		ll ti = mi[i];
		for (int j = 0; j < (int)ve.size(); j++) {
			ti = ti + 1 + ve[j];
			if (t < ti)break;
			cnt++;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 14484
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;

int main() {
	double a;
	cin >> a;
	cout << fixed <<setprecision(6) <<a*a*M_PI << " " << setprecision(6) <<2*a*M_PI << endl;
	return 0;
}

Measured memory_bytes: 1288
n=int(input())
s=input()
l=set()
r=set()

for i in range(0,n-2):
    a=set()
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        b=set()
        if s[j] in a:
            continue
        else:
            a.add(s[j])
        for k in range(j+1,n):
            if s[k] in b:
                continue
            else:
                b.add(s[k])
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))


Measured memory_bytes: 41580
#include<bits/stdc++.h>
#include<sstream>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main(){ _;
  string s,p;
  cin>>s>>p;
  stringstream ss;
  ss<<s<<s;
  if(strstr(ss.str().c_str(),p.c_str()))
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

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

using namespace std;
vector<long long> factors;
#define ll long long


#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

template<typename T>
int BS(vector<T> &mas, T val)
{
	int l, r;
	l = 0;
	r = mas.size() - 1;
	while (r - l > 1)
	{
		int mid = l + (r - l) / 2;
		if (mas[mid] < val)
		{
			l = mid;
		} else
			r = mid;
	}
	if (mas[r] == val)
		return r;
	if (mas[l] == val)
		return l;
	return -1;
}

template<typename T>
int UBS(vector<T> &mas, T val)
{
	int l, r;
	l = 0;
	r = mas.size() - 1;
	while (r - l > 1)
	{
		int mid = l + (r - l) / 2;
		if (mas[mid] < val)
		{
			l = mid;
		} else
			r = mid;
	}

	if (mas[l] >= val)
		return l;
	if (mas[r] >= val)
		return r;
	return -1;
}

ll mod(ll a, ll m)
{ return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//

int main()
{
	IOS

	ll n,k;
	cin >> n >> k;

	if(n/2 + n%2 >= k){
		cout << "YES";
	} else
		cout << "NO";

	return 0;
}


Measured memory_bytes: 256
n, m = [int(v) for v in input().split()]

ans = 0
if n == 1 and m == 1:
    ans = 1
elif n == 1:
    ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n-2) * (m-2)

print(ans)

Measured memory_bytes: 3060
nn = int(input())
number_of_match = [0 for _ in range(10005)]
for xx in range(1,105):
  xxxx = xx**2
  for yy in range(1,105):
    yyyy = yy**2
    xxyy = xx*yy
    for zz in range(1,105):
      result = xxxx + yyyy + (zz)**2 + xxyy + (yy)*(zz) + (zz)*(xx)
      if result < 10005:
        number_of_match[result] += 1
for i in range(1,nn+1):
  print(number_of_match[i])

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

int main () {
  int N;
  cin >> N; 
  
  if (N > 888) cout << 999 << endl;
  else if (N > 777) cout << 888 << endl;
  else if (N > 666) cout << 777 << endl;
  else if (N > 555) cout << 666 << endl;
  else if (N > 444) cout << 555 << endl;
  else if (N > 333) cout << 444 << endl;
  else if (N > 222) cout << 333 << endl;
  else if (N > 111) cout << 222 << endl;
  else  cout << 111 << endl;
}

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

int main() {
  
  string s;
  cin >> s;
  
  int a,b,c,d;
  a = s[0] - '0';
  b = s[1] - '0';
  c = s[2] - '0';
  d = s[3] - '0';
  
  if ( a + b + c + d == 7 ){
    cout << a << '+' << b << '+' << c << '+' << d << "=7" << endl;
  }else if ( a + b + c - d == 7 ){
    cout << a << '+' << b << '+' << c << '-' << d << "=7" << endl;
  }else if ( a + b - c + d == 7 ){
    cout << a << '+' << b << '-' << c << '+' << d << "=7" << endl;
  }else if ( a - b + c + d == 7 ){
    cout << a << '-' << b << '+' << c << '+' << d << "=7" << endl;
  }else if ( a + b - c - d == 7 ){
    cout << a << '+' << b << '-' << c << '-' << d << "=7" << endl;
  }else if ( a - b + c - d == 7 ){
    cout << a << '-' << b << '+' << c << '-' << d << "=7" << endl;
  }else if ( a - b - c + d == 7 ){
    cout << a << '-' << b << '-' << c << '+' << d << "=7" << endl;
  }
  
  return 0;   

}

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

using namespace std;

using ll = long long;

vector<int> parse(int n, string& s) {
    char c = s[0];
    int tmp = 1;
    vector<int> res;
    for (int i = 1; i < n; i++) {
        if (s[i] != c) {
            c = s[i];
            res.push_back(tmp);
            tmp = 1;
        } else {
            tmp++;
        }
    }
    res.push_back(tmp);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    string s;
    cin >> s;

    vector<int> v = parse(n, s);
    int ans = 0;
    for (int x : v) {
        ans += x - 1;
    }

    int sz = v.size();
    int cnt2 = (sz - 1) / 2;
    int cnt1 = (sz - 1) % 2;
    cnt2 = min(cnt2, K);
    K -= cnt2;
    ans += 2 * cnt2;
    if (K) ans += cnt1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 972
a=int(input())
ts=0
hs=0
while a>0:
   tarou , hanako = input().split(" ")
   if tarou < hanako:
     hs+=3
   elif tarou > hanako:
     ts+=3
   else:
     hs+=1													
     ts+=1
   a=a-1
print(str(ts)+' '+str(hs))
   



Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);cout.tie(NULL);
        int n,a,ans=0;
        cin>>n;
        for(int i=1;i<=n;i++){
                cin>>a;
                if(i%2==1 && a%2==1){
                        ans++;
                }
                
        }
        cout<<ans;
        return 0;
}
/*

        creation time:  13.09.2020 09:23:27

*/                      



Measured memory_bytes: 3572
import heapq
 
x, y, a, b, c = map(int, input().split())
 
def max_listup(limit):
  l = sorted(list(map(int, input().split())))
  cnt = 1
  res = []
  while l:
    if cnt > limit:
      break
    m = l.pop()
    res.append(m)
    cnt += 1
  return res

all = sorted(max_listup(x) + max_listup(y) + list(map(int, input().split())))
ans = 0
for _ in range(x+y):
  ans += all.pop()

print(ans)

Measured memory_bytes: 22520
def resolve():
    n,a,b=map(int, input().split())
    s=list(input())
    cnt=0
    cnt_b=0
    for i in range(n):
        if s[i]=='c':
            print('No')
        elif s[i]=='a':
            if cnt<a+b:
                print('Yes')
                cnt+=1
            else:
                print('No')
        else:
            if cnt<a+b and cnt_b<b:
                print('Yes')
                cnt+=1
                cnt_b+=1
            else:
                print('No')
resolve()

Measured memory_bytes: 4712
N,C = map(int, input().split())
xv = []
for _ in range(N):
    xv.append(tuple(map(int, input().split())))
ccw_first = [0]
ccw_second = [0]
cw_first = [0]
cw_second = [0]
sm = 0
for x,v in xv:
    sm += v
    ccw_first.append(max(ccw_first[-1], sm - 2 * x))
    ccw_second.append(max(ccw_second[-1], sm - x))
sm = 0
for x,v in reversed(xv):
    sm += v
    cw_first.append(max(cw_first[-1], sm - 2 * (C - x)))
    cw_second.append(max(cw_first[-1], sm - (C - x)))
ans = 0
for i in range(N+1):
    ans = max(ans, cw_first[i] + ccw_second[N-i], ccw_first[i] + cw_second[N-i])
print(ans)

Measured memory_bytes: 29452
//go:generate echo "https://atcoder.jp/contests/abc177/tasks/abc177_a"
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func solve(d, t, s int) bool {
	return float64(d) / float64(s) <= float64(t)
}

func main() {
	scan := newScanner(os.Stdin)
	d, t, s := scan.Int(), scan.Int(), scan.Int()
	if solve(d, t, s) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1772
//--------ROMAN ITERATION -------------
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i :c)
#define pii pair< int,int >
#define Fast_IO() ios_base::sync_with_stdio(false);cin.tie(0)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
const int MOD = 1000 * 1000 * 1000 + 7; // odd modulus
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int main()
{
    Fast_IO();
    int n , k ;
    cin >> n >> k ;
    vi v ( n , 0 ) ;
    vi dp ( n +1 , 0  ) ;
    for ( int & x : v )
    cin >>x ;
    int cnt = 1 ;
    for ( int i = 1  ; i <= n ; ++i  )
    {
        dp[i] = dp[i-1 ] + v[i-1] ;
        cnt+= (dp[i] <= k ) ;

        }
cout<< cnt ;



    return 0 ;
}



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


int main() {
int a,b;
cin >> a >> b;

if (b > a) {
    vector<int> vec(b);
for (int i = 0;i < b;i++) {
 vec.at(i) = a;
 
}
for (int i = 0;i < vec.size();i++) {
    cout << vec.at(i);
}
} else if (a >= b) {
    vector<int> vec(a);
 for (int i = 0;i < a;i++) {
    
    vec.at(i) = b;
}   
for (int i = 0;i < vec.size();i++) {
    cout << vec.at(i);
}
}

cout << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int gcd(int a,int b){
  if(b == 0) return a*a;
  return gcd(b,a%b);
}
int main(){
  int w,h,c;
  cin >>w>>h>>c;
  cout <<w*h/gcd(w,h)*c<<endl;
  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)2e9;

int v, e;
V< V<int> > edges;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> v >> e;
    edges.resize(v, V<int>(v, INF));
    for (int i = 0; i < v; i++) edges[i][i] = 0;
    for (int i = 0; i < e; i++) {
        int s, t, d; cin >> s >> t >> d;
        edges[s][t] = d;
    }

    for (int k = 0; k < v; k++) {
        for (int i = 0; i < v; i++) {
            for (int j = 0; j < v; j++) {
                if (edges[i][k] == INF || edges[k][j] == INF) continue;
                chmin(edges[i][j], edges[i][k] + edges[k][j]);
            }
        }
    }

    for (int i = 0; i < v; i++) {
        for (int j = 0; j < v; j++) {
            for (int k = 0; k < v; k++) {
                if (edges[i][k] == INF || edges[k][j] == INF) continue;
                if (edges[i][j] > edges[i][k] + edges[k][j]) {
                    cout << "NEGATIVE CYCLE\n";
                    return 0;
                }
            }
        }
    }

    for (int i = 0; i < v; i++) {
        for (int j = 0; j < v; j++) {
            cout << (edges[i][j] == INF ? "INF" : to_string(edges[i][j])) << (j == v - 1 ? '\n' : ' ');
        }
    }

    return 0;
}



Measured memory_bytes: 3336