akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     2019
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif

}

int dp[3005][3005];
string s,t;


int fun(int idx_s,int idx_t)
{
	
	//db(idx_s,idx_t);
	if((idx_s==s.size())||(idx_t==t.size()))
		return dp[idx_s][idx_t]=0;
	if(dp[idx_s][idx_t]!=-1)
		return dp[idx_s][idx_t];
	int &ans=dp[idx_s][idx_t];
	if(s[idx_s]==t[idx_t])
		ans=1+fun(idx_s+1,idx_t+1);
	ans=max(ans,fun(idx_s+1,idx_t));
	ans=max(ans,fun(idx_s,idx_t+1));

	return ans;
}

int32_t main()
{
	fastIO
	//inp_out();
	//string s,t;
	memset(dp,-1,sizeof(dp));
	cin>>s>>t;
	fun(0,0);
	string ans="";
	int idx_s=0,idx_t=0;
	while (idx_s<s.size() and idx_t<t.size())
	{
	    if ((dp[idx_s+1][idx_t+1]==dp[idx_s][idx_t]-1) and (s[idx_s]==t[idx_t]) and dp[idx_s][idx_t]!=0)
	    {
	    	ans+=s[idx_s];
	        idx_s+=1;
	        idx_t+=1;
	    }
	    else if (dp[idx_s][idx_t]==dp[idx_s+1][idx_t])
	        idx_s+=1;
	    else
	        idx_t+=1;
	}
	cout<<ans;


	return 0;
}


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

int main()
{
int x,y;
for(int d=1;d<=1000;d++)
{
cin >> x >> y;
if(x!=0)
{
for(int b=1;b<=x/2;b++)
{
for(int a=1;a<=y/2;a++)
{cout << "#.";}
if(y%2==1)
{cout << "#";}
cout << endl;
for(int a=1;a<=y/2;a++)
{cout << ".#";}
if(y%2==1)
{cout << ".";}
cout << endl;
}
if (x%2==1)
{
for(int c=1;c<=y/2;c++)
{cout << "#.";}
if(y%2==1)
{cout << "#";}
cout << endl;
}
cout << endl;
}
}
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);

   char a;
   cin>>a;
   int temp=a;
   if(temp>90)
   {
   	cout<<'a';
   }
   else
   {
   	cout<<'A';
   }
}


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

int main(){
  int n, Ans = 0, Cnt = 1;
  bool flag = false;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n - 1; i++) {
    if(a[i] == a[i + 1]) Cnt++;
    else Ans += Cnt / 2, Cnt = 1;
  }
  cout << Ans + Cnt / 2 << endl;
}

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

int main(){
    string s,t,u;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    cin>>u;
    if(u==s)a--;
    else b--;

    cout<<a<<" "<<b<<endl;

    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [x, y] <- getIntList
    print $ solve x y

solve x y | n `mod` 3 /= 0 || m `mod` 3 /= 0 = 0
          | n' < m' = comb (n' + m') n'
          | otherwise = comb (n' + m') m'
    where n = 2 * y - x
          m = 2 * x - y
          n' = n `div` 3
          m' = m `div` 3

moduloN :: Int
moduloN = 10 ^ 9 + 7

modN = flip mod moduloN

finv :: Int -> Int
finv k = finvs V.! k
    where finvs :: V.Vector Int
          finvs = V.generate (10 ^ 6 + 1) finv'
              where finv' 0 = 1
                    finv' n = modN $ finvs V.! (n - 1) * inv n

inv :: Int -> Int
inv k = invs V.! k
    where inv' 1 = 1
          inv' n = modN (-(invs V.! r) * q)
              where (q, r) = moduloN `divMod` n
          invs :: V.Vector Int
          invs = V.generate (10 ^ 6 + 1) inv'

fact :: Int -> Int
fact k = facts V.! k
    where fact' 0 = 1
          fact' n = modN $ n * (facts V.! (n - 1))
          facts :: V.Vector Int
          facts = V.generate (10 ^ 6 + 1) fact'

comb :: Int -> Int -> Int
comb n k | n < 0 || k < 0 || n < k = 0
         | otherwise = modN $ modN (fact n * finv k) * finv (n - k)

Measured memory_bytes: 124284
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String[] cns = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"};
    int[][] cs = {{0, 0, 0},
                  {0, 0, 255},
                  {0, 255, 0},
                  {0, 255, 255},
                  {255, 0, 0},
                  {255, 0, 255},
                  {255, 255, 0},
                  {255, 255, 255}};
    while (scanner.hasNext()) {
      String line = scanner.nextLine();
      if (line.equals("0")) {
        break;
      }
      int hikaru = Integer.parseInt(line.substring(1, 3), 16);
      int umi = Integer.parseInt(line.substring(5, 7), 16);
      int fuu = Integer.parseInt(line.substring(3, 5), 16);
      int topc = 0;
      double topd = Double.MAX_VALUE;
      for (int ii = 0; ii < 8; ii++) {
        double d = Math.sqrt((cs[ii][0] - hikaru) * (cs[ii][0] - hikaru) +
                             (cs[ii][2] - umi) * (cs[ii][2] - umi) +
                             (cs[ii][1] - fuu) * (cs[ii][1] - fuu));
        if (d < topd) {
          topc = ii;
          topd = d;
        }
      }
      System.out.println(cns[topc]);
    }
  }
}

Measured memory_bytes: 26240
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  cin.tie(0);
  ios::sync_with_stdio(false);


  int n;
  cin >> n;
  ll sum = 0;
  for (int i = 1; i<= n; ++i) {
    if (i % 3 == 0 || i % 5 == 0) {
      continue;
    }
    sum += i;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3184
#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;
  cin>>N;
  int ans=0;
  for(int i=1;i<=N;i++){
    int d=0;
    for(int j=1;j<=N;j++){
      if(i%j==0)d++;
    }
    if(d==8&&i%2)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();

		int ans = 0;
		int cnt = 0;
		for (int i = Math.min(A, B); i > 0 ; i--) {
			if (A % i == 0 && B % i == 0) {
				ans = i;
				cnt++;
				if (cnt == K) break;
			}
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
    string s;
    cin >> s;
    rep(i, s.size()) {
        if (s[i] == ',') cout << ' ';
        else cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3544
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " <<a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("D:\\input.txt", "r", stdin);
	freopen("D:\\output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n;
		cin >> n;
		vi a(n), b(n);
		rep(i, 0, n)
		cin >> a[i];
		rep(i, 0, n)
		cin >> b[i];

		reverse(all(b));
		ll c = -1, l = 0, r = -1;
		rep(i, 0, n)
		if (a[i] == b[i])
		{
			c = a[i];
			break;
		}

		rep(i, 0, n)
		{
			if (a[i] == c and b[i] == c)
			{
				l = i;
				break;
			}
		}

		per(i, n - 1, 0)
		{
			if (a[i] == c and b[i] == c)
			{
				r = i;
				break;
			}
		}
		rep(i, 0, n)
		{
			if (a[i] != c and b[i] != c and l <= r)
			{
				swap(b[i], b[l]);
				l++;
			}
		}

		if (l <= r)
			cout << "No\n";
		else
		{
			cout << "Yes\n";
			rep(i, 0, n)
			cout << b[i] << " ";
		}
	}
	return 0;
}

Measured memory_bytes: 6364
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%d" id
let () =
  ListL.map (1++n) ~f:(fun i ->
      if i mod 3 = 0 || i mod 5 = 0 then 0 else i)
  |> List.sum
  |> Printf.printf "%d\n"


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

#define LL long long
#define COIN const int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int n,i,cnt;
string s;
vector < pair<int,string> > v; 
map <string,int> mp;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >>n;
	REP(i,n)
	{
		cin >>s;
		mp[s]++;
	}
	for (map <string,int>::iterator it=mp.begin();it!=mp.end();it++)
		v.PB(MP(-it->second,it->first));
	sort(v.begin(),v.end());
	cnt=v.begin()->first;
	for (i=0;i<v.size();)
	{
		if (v[i].first!=cnt) break;
		cout <<v[i].second<<endl;
		i++;
	}
	return 0;
}
/******************************************************************************
******************************************************************************/


Measured memory_bytes: 29300
#include <bits/stdc++.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++)
const int INF = 1001001001;
using ll = long long;

int main(){
    string S;
    cin >> S;
    int ans=0;
    if(S=="RRR") cout << 3 << endl;
    else if(S=="RRS" || S=="SRR") cout << 2 << endl;
    else if(S=="SSS") cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}

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

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }

const long long INF = 1LL << 60;

bool dp[100100];

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

    map<string,int> memo;
    rep(i,N){
        string s;
        cin >> s;
        memo[s] += 1;
    }

    int max =0;
    for(const auto& x :memo){
        int v =x.second;
        if(v > max) max =v;
    }
    for( auto it = memo.begin(); it != memo.end(); it++){
        if(it -> second == max){
            cout << it ->first << endl;
        }
    }



}



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

typedef long long ll;

ll ar[3000];

int main()
{
    ll m=2019;
    ll a,b,ans=1e12;
    cin>>a>>b;
    if(b-a+1>=m)
    {
        cout<<0<<endl;
        return 0;
    }

    ll x;
    for(int i=a;i<=b;i++)
    {
        for(int j=i+1;j<=b;j++)
        {
            x = (i%m *j%m)%m;
            ans=min(ans,x);
            /*if(x<=ans)
            {
                ans=x;
                cout<<i<<" "<<j<<" "<<ans<<endl;
            }
            cout<<i<<" "<<j<<" "<<ans<<endl;*/
        }
    }

    cout<<ans<<endl;
}



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

bool isBingo(vector<int> sheet, int a, int b, int c){
  return (sheet[a]==0&&sheet[b]==0&&sheet[c]==0);
}

int main(){
  vector<int> sheet;
  int a;
  for(int i=0;i<9;i++){
    cin >> a;
    sheet.push_back(a);
  }
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    for(int j=0;j<sheet.size();j++){
      if(sheet[j]==a){
        sheet[j] = 0;
        break;
      }
    }
  }
  if(isBingo(sheet,0,1,2)||isBingo(sheet,3,4,5)||isBingo(sheet,6,7,8)||isBingo(sheet,0,3,6)||isBingo(sheet,1,4,7)||isBingo(sheet,2,5,8)||isBingo(sheet,0,4,8)||isBingo(sheet,2,4,6)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

struct UnionFind {
    vi v;
    UnionFind(int n=0) : v(n, -1) {}
    int find(int x) {
        if (v[x] < 0) return x;
        return (v[x] = find(v[x]));
    }
    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (x > y) swap(x, y);
        v[x] += v[y];
        v[y] = x;
        return true;
    }
    int size(int x) {
        return abs(v[find(x)]);
    }
    bool same(int x, int y) {
        if (find(x) == find(y)) return true;
        else return false;
    }
};

int d[100005];
vi blk[100005];

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        d[a]++; d[b]++;
        uf.unite(a, b);
    }
    rep(i, k) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        blk[a].push_back(b);
        blk[b].push_back(a);
    }
    rep(i, n) {
        int ans;
        ans = uf.size(i) - 1 - d[i];
        for (int o : blk[i]) {
            if (uf.same(i, o)) ans--;
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
    }
    return 0;
}



Measured memory_bytes: 6784
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <random>

using ll = long long int;
using P = std::pair<ll, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int l[30];
ll c[30],s[400][30];
std::vector<P> v;

int main(void){
	int d,i,j,n=26;
	ll ansm = -INFLL;
	std::cin >> d;
	for(i=0; i<n; ++i){
		l[i] = -1;
		std::cin >> c[i];
	}
	for(i=0; i<d; ++i){
		for(j=0; j<n; ++j){
			std::cin >> s[i][j];
		}
	}
	for(i=0; i<d; ++i){
		for(j=0; j<n; ++j){
			v.push_back(P(s[i][j]+c[j]*(i-l[j]),j+1));
		}
		std::sort(v.begin(),v.end(),std::greater<P>());
		std::cout << v[0].second << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3840
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
	int x,a,b;
	scanf("%d",&x);
	a=x/100;
	b=x%100;
	if(b<=5*a)printf("1\n");
	else printf("0\n");
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<int> freqs(1e5 + 5, 0);
  int a;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a);
    ++freqs[a];
    ++freqs[a + 1];
    ++freqs[a + 2];
  }
  int ans = *max_element(freqs.begin(), freqs.end());
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#define N 102

using namespace std;

int n, m;
int a[N][N], b[N][N], link[N], c[N];
bool book[N][N], vis[N], mat[N];

vector<int> e[N];

bool dfs(int);

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j)
			scanf("%d", a[i] + j);
	for(int now = 1; now <= m; ++now){
		for(int i = 1; i <= n; ++i) e[i].clear();
		for(int i = 1; i <= n; ++i)
			for(int j = 1; j <= m; ++j){
				if(book[i][j]) continue;
				e[(a[i][j] - 1) / m + 1].push_back(i);
			}
		memset(link, 0, sizeof link);
		memset(mat, false, sizeof mat);
		for(int i = 1; i <= n; ++i){
			if(mat[i]) continue;
			memset(vis, false, sizeof vis);
			dfs(i);
		}
		for(int i = 1; i <= n; ++i){
			int p = link[i];
			for(int j = 1; j <= m; ++j){
				if(book[i][j] || (a[i][j] - 1) / m + 1 != p) continue;
				b[i][now] = a[i][j]; book[i][j] = true; break;
			}
		}
	}
	for(int i = 1; i <= n; ++i, puts(""))
		for(int j = 1; j <= m; ++j)
			printf("%d ", b[i][j]);
	for(int j = 1; j <= m; ++j){
		for(int i = 1; i <= n; ++i) c[i] = b[i][j];
		sort(c + 1, c + 1 + n);
		for(int i = 1; i <= n; ++i) b[i][j] = c[i];
	}
	for(int i = 1; i <= n; ++i, puts(""))
		for(int j = 1; j <= m; ++j)
			printf("%d ", b[i][j]);
	return 0;
}

bool dfs(int u){
	if(vis[u]) return false;;
	vis[u] = true; int sz = e[u].size();
	for(int i = 0; i < sz; ++i){
		int v = e[u][i];
		if(!link[v] || dfs(link[v])){
			mat[u] = true, link[v] = u;
			return true;
		}
	}
	return false;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		if(n > 0 && n < 1000) {
			System.out.println("ABC");
		}
		if(n > 999 && n < 1999) {
			System.out.println("ABD");
		}
	}
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 5e5;
const int MAXV = (1<<20);
const ll MOD = 1e9+7;

int N, A[MAXN+10], zero[MAXN+10];
vector<int> pos[MAXV+10];

ll solve(int x, int t)
{
    int i, j;
    ll dp[2]={1, 0};
    for(i=1; i<pos[x].size(); i++)
    {
        ll now=pos[x][i], gap=zero[pos[x][i]]-zero[pos[x][i-1]];
        dp[0]+=gap*dp[1]%MOD;
        dp[1]+=dp[0];
        dp[0]%=MOD; dp[1]%=MOD;
        //printf("%lld %lld %lld\n", dp[0], dp[1], gap);
    }
    return dp[t];
}

int main()
{
    int i, j;

    scanf("%d", &N);
    for(i=1; i<=N; i++) scanf("%d", &A[i]), A[i]^=A[i-1];
    for(i=1; i<=N; i++) zero[i]=zero[i-1]+(A[i]==0);

    for(i=0; i<MAXV; i++) pos[i].push_back(0);
    for(i=1; i<=N; i++) pos[A[i]].push_back(i);

    if(A[N]!=0)
    {
        printf("%lld", solve(A[N], 0));
    }
    else
    {
        ll ans=0;
        for(i=1; i<MAXV; i++) ans=(ans+solve(i, 1))%MOD;
        ll t=1;
        for(i=1; i<zero[N]; i++) t=t*2%MOD;
        ans+=t;
        ans%=MOD;
        printf("%lld", ans);
    }
}


Measured memory_bytes: 64380
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] nums = new long[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        Arrays.sort(nums);
        if(n%2==0){
            for(int i=0;i<n;i+=2){
                if(nums[i]!=nums[i+1]||nums[i]!=2*(i/2)+1){
                    System.out.println(0);
                    return;
                }
            }
        }else{
            if(nums[0]!=0){
                System.out.println(0);
                return;
            }
            for(int i=1;i<n;i+=2){
                if(nums[i]!=nums[i+1]||nums[i]!=2*(i/2+1)){
                    System.out.println(0);
                    return;
                }
            }
        }
        long output=1;
        for(int i=0;i<n/2;i++){
            output*=2;
            output%=1000000007;
        }
        System.out.println(output);
    }

}

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

int main() {
	int N;
	cin >> N;
	map<string, int> cnt;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		cnt[s]++;
	}

	for (string s : {"AC", "WA", "TLE", "RE"}) {
		cout << s << " x " << cnt[s] << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  char x,y;cin>>x>>y;

  if(x<y)out('<')
  else if(x>y)out('>')
  else out("=")


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n,q; cin>>n>>q;
    vector<vector<int>> g(n);
    rep(i,n-1) {
        int a,b; cin>>a>>b; --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<ll> ans(n);
    rep(i,q) {
        ll p,x; cin>>p>>x; --p;
        ans[p] += x;
    }

    vector<bool> vi(n,false);
    auto dfs = [&](auto &&f, int x, ll c) -> void {
        if (vi[x]) return;
        vi[x] = true;
        ans[x] += c;
        for (auto &&e: g[x]) {
            f(f,e,ans[x]);
        }
        return;
    };

    dfs(dfs,0,0);
    print(ans);

    return 0;
}

Measured memory_bytes: 20480
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int N;
vector<vector<int>> A(2);

int dfs(int x, int y, int ans)
{
    if (x > N-1 or y >= 2) return 0;
    if (x == N-1 and y == 1) return ans+A[y][x];
    return max(dfs(x+1, y, ans+A[y][x]),
               dfs(x, y+1, ans+A[y][x]));
}

int main()
{
    cin >> N;
    rep (i, 0, 2) {
        rep (j, 0, N) {
            int in; cin >> in;
            A[i].push_back(in);
        }
    }

    cout << dfs(0, 0, 0) << endl;
}

Measured memory_bytes: 256
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<typeof((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  REP(i, s.length()) {
    if (i % 2 == 0) {
      cout << s[i];
    }
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 592
#include <cmath>
#include <iostream>
using namespace std;
int p, n; long double d;
int main() {
	while (cin >> p >> n, n) {
		d = sqrtl(p);
		int p1 = 999999, q1 = 1, p2 = 0, q2 = 1;
		for (int i = 1; i <= n; i++) {
			int j = i / d;
			if (0 < j && j <= n && 1.0L * i / j < 1.0L * p1 / q1) p1 = i, q1 = j;
			if (0 < (j + 1) && (j + 1) <= n && 1.0L * i / (j + 1) > 1.0L * p2 / q2) p2 = i, q2 = j + 1;
		}
		cout << p1 << '/' << q1 << ' ' << p2 << '/' << q2 << endl;
	}
	return 0;
}

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

int main()
{
  int n,A[100001],L[100001],k;

  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
  L[0]=A[0];k=1;

  for(int i=1;i<n;i++){
    if(L[k-1]<A[i])L[k++]=A[i];
    else *lower_bound(L,L+k,A[i])=A[i];
  }
  cout<<k<<endl;
  
  return 0;
}

Measured memory_bytes: 1936
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int N, M, A[100];

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

    cin >> N >> M;
    vi odd, even;
    rep(i, M) {
        cin >> A[i];
        (A[i] & 1 ? odd : even).push_back(A[i]);
    }

    if(sz(odd) > 2) {
        cout << "Impossible" << endl;
        return 0;
    }

    vi a, b;
    if(sz(odd))a.push_back(odd[0]);
    each(e, even)a.push_back(e);
    if(sz(odd) == 2)a.push_back(odd[1]);
    if(a[0] - 1 > 0)b.push_back(a[0] - 1);
    FOR(i, 1, sz(a) - 1)b.push_back(a[i]);
    b.push_back(N - accumulate(all(b), 0));
    rep(i, M)cout << a[i] << (i != M - 1 ? ' ' : '\n');
    cout << sz(b) << endl;
    rep(i, sz(b))cout << b[i] << (i != sz(b) - 1 ? ' ' : '\n');
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int s, w; cin >> s >> w;
	cout << (w >= s ? "unsafe" : "safe") << "\n";

	return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<int>> vec(M,vector<int>(2));
  for(int i=0; i<M; i++){
    for(int j=0; j<2; j++){
      cin >> vec.at(i).at(j);
    }
  }
  sort(vec.begin(),vec.end());
  vector<int> one(0);
  int y = 0;
  for(int i=0; i<M; i++){
    if(vec.at(i).at(0) == 1){
      one.push_back(vec.at(i).at(1));
    }
    else{
      y = i;
      break;
    }
  }
  sort(one.begin(),one.end());
  
  bool exist = false;
  int x = -1;
  for(int i=0; i<one.size(); i++){
    for(int j=y; j<M; j++){
      if(vec.at(j).at(0) == one.at(i) && vec.at(j).at(1) == N){
        exist = true;
        break;
      }
      if(vec.at(j).at(0) > one.at(i)){
        y = j-1;
        break;
      }    
    }
  }
  
  if(exist){
    cout << "POSSIBLE" << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
    
}

Measured memory_bytes: 11776
// Problem : C - Ubiquity
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
 
#define endl "\n"
#define int long long
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define rep(n) for(int i=0;i<(n);i++)
#define rrep(n) for(int i=(n)-1;i>=0;i--)
#define mem(a,b) memset((a),(b),sizeof (a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define INF (long long) 1e18
#define MOD 1000000007


void solve(){
      int n;
      cin>>n;
      int a=1,b=1,c=1;
      for(int i=1;i<=n;i++){
            a = (a*10)%MOD;
            b = (b*9)%MOD;
            c = (c*8)%MOD;
      }
      int ans = (a+c-(2*b)%MOD+MOD)%MOD;
      cout<<ans<<endl;
}

int32_t main(){
      int t=1;
      //cin>>t;
      while(t--)
            solve();
      return 0;
}




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

#define ms(s, n) memset(s, n, sizeof(s))
#define f(i, a, b) for (int i = (a); i <=(b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) - 1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
int modulo(int a, int b) { return (a % b + b) % b; }
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

/*
class Compare
{
  public:
    bool operator()(pi a,pi b)
    {
      if(a.first<b.first || (a.first==b.first && a.second>b.second))
        return true;
      return false;
    }
};
*/

int main()
{
	IOS;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	string s, t;
	cin >> s >> t;
	ll n = s.length(), ans = 0;
	f(i, 0, n - 1) {
		if (s[i] != t[i])
			ans++;
	}
	cout << ans << endl;
	// read the stuff at the bottom
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/





























Measured memory_bytes: 3768
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
    cout << a << endl;
    exit(0);
}

void push(bool a)
{
    cout << (a?1:0) << endl;
}

void Main(void)
{
    ll n, q; cin >> n >> q;
    dsu d(n);
    rep(i, q)
    {
        ll t, a, b; cin >> t >> a >> b;
        if(t)
        {
            push(d.same(a, b));
        }
        else d.merge(a, b);
    }
    return;
}

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12); //高精度少数表示
    Main();
    return 0;
}

Measured memory_bytes: 3968
#define ll long long
#define ffor(i,a,b) for (int i=(a);i<(b);i++)
#define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;


void input_txt(char (*a)[51],int n){
	rep(i,n){
		rep(j,n)cin >> a[i][j];
	}
}

bool turn(int n,int m,char (*a)[51],char (*b)[51]){
	bool exist = false;
	rep(i,n){
		rep(j,n){
				bool match = true;
				if(i+m-1>n or j+m-1>n) continue;//超えたら止まる
				for(int y=0;y<m;y++){
					for(int x=0;x<m;x++){
						if(a[i+y][j+x]!=b[y][x]) match=false;
					}
				}
				if(match) exist=true;
		}
	}
	return exist;
}

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

	//入力
	int m,n;
	char a[51][51],b[51][51];
	cin >> n >> m;
	input_txt(a,n);
	input_txt(b,m);

	cout << ((turn(n,m,a,b)) ? "Yes":"No") <<endl;
	return 0;
}

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

struct UnionFind {
	
	int numSets;
	int *padre;
	int *rango;
	int *numVertices;

	UnionFind(int N) : numSets(N) {
		padre = new int[N + 1];
		rango = new int[N + 1];
		numVertices = new int[N + 1];
		for (int i = 0; i <= N; ++i) {
			padre[i] = i;
			rango[i] = 0;
			numVertices[i] = 1;
		}
	}

	int findSet(int x) {
        return (x == padre[x]) ? x : (padre[x] = findSet(padre[x]));
    }

    bool isSameSet(int x, int y) {
       	return findSet(x) == findSet(y);
    }

    void unionSet(int x, int y) {
        int xRoot = findSet(x);
        int yRoot = findSet(y);
		if (!isSameSet(xRoot, yRoot)) {
			if (rango[xRoot] > rango[yRoot]) {
				padre[yRoot] = xRoot;
				numVertices[xRoot] += numVertices[yRoot];
			}
			else {
				padre[xRoot] = yRoot;
				numVertices[yRoot] += numVertices[xRoot];
				if (rango[xRoot] == rango[yRoot])
					rango[yRoot]++;
			}
            numSets--;
        }
    }

    int sizeOfSet(int x) {
    	return numVertices[findSet(x)];
    }
};

int main() {
	int n, m, a, b;

	cin >> n >> m;
	UnionFind ds(n);
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		ds.unionSet(a, b);
	}
	int cnt = 0;
	for (int i = 2; i <= n; i++) {
		if (!ds.isSameSet(i, i - 1)) {
			ds.unionSet(i, i - 1);
			cnt++;
		}
	}
	cout << cnt << "\n";
	return 0;
}

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

int main(){
    deque<char> ans;
    int rev = 0;

    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        ans.push_back(s.at(i));
    }

    int q, t, f;
    char c;

    cin >> q;
    rep(i,q){
        cin >> t;
        if(t == 1){
            rev = 1 - rev;
        }else{
            cin >> f >> c;
            if( (rev == 0 && f == 1) || (rev == 1 && f == 2) ){
                ans.push_front(c);
            }else if( (rev == 0 && f == 2) || (rev == 1 && f == 1)){
                ans.push_back(c);
            }
        }
    }

    if(rev == 1) reverse(ans.begin(), ans.end());

    rep(i,ans.size()){
        cout << ans.at(i);
    }
    cout << endl;

    return 0;

}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    int n;
    cin >> n;
    string s;
    map <string, ll> a;
    rep (i,0,n) {
        cin >> s;
        sort(s.begin(),s.end());
        a[s]++;
    }
    ll ans = 0;
    for (auto i = a.begin(); i != a.end();i++) {
        ll x = i->second;
        ans += x * (x-1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    int N, A, B;
    cin >> N >> A >> B;

    int train, taxi, min;
    train = A * N;
    taxi = B;
    if (train < taxi){
        min = train;
    }else{
        min = taxi;
    }

    cout << min << endl;
}

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

int main(){
  int n,k,l;
  cin>>n>>k; 
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    l += 2*min(k-x,x);
  }
  
  cout<<l<<endl;
  return 0;
}

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

int main(){
  string s;
  cin>>s;
  long long int A=0,count=0,n=s.size(),c=0;
  for(int i=0;i<n-1;i++){
    count++;
    if(s[i]=='<'&&s[i+1]=='>') c=count;
    else if(s[i]=='>'&&s[i+1]=='<'&&c>count){
      count=c;
      A+=count;
    }
    else A+=count;
    if(s[i]!=s[i+1]){
      count=0;
    }

  }
  count++;
  if(s[n-2]=='<'&&s[n-1]=='>'&&c>count){
      count=c;
      A+=count;
  }
  else A+=count;
  cout<<A<<endl;
}
 

Measured memory_bytes: 900
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define all(v) (v).begin(),(v).end()
using ll = long long;
constexpr ll INF = 1e18;

vector<ll> solver(ll N, ll Q, vector<ll> t, vector<ll> u, vector<ll> v) {
    dsu d(N);
    vector<ll> ans;
    for (int i = 0; i < Q; i++) {
        if (t[i] == 0) {
            d.merge(u[i], v[i]);
        } else {
            ans.push_back(d.same(u[i], v[i]));
        }
    }
    return ans;
}

int main(void) {
    ll N, Q;
    cin >> N >> Q;
    vector<ll> t(Q), u(Q), v(Q);
    for (int i = 0; i < Q; i++) {
        cin >> t[i] >> u[i] >> v[i];
    }
    for (auto&& x : solver(N, Q, t, u, v)) {
        cout << x << endl;
    }
    return 0;
}



Measured memory_bytes: 13220
use std::io::*;
use std::str::FromStr;
use std::collections::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn get_next_prime(mut x: usize) {
    loop {
        let mut is_prime_cnt = 0;
        for p in 2..x {
            if x%p==0 {
                break;
            } else {
                is_prime_cnt += 1;
            }
        }
        if is_prime_cnt==x-2 {
            println!("{}", x);
            return;
        }
        x += 1;
    }
}


fn main() {
    let X: usize = read();
    get_next_prime(X);
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <utility>
#include <set>
#include <bitset>
#define ls x<<1
#define rs x<<1|1
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(x) scanf("%d", &x)
#define scdd(x,y) scanf("%d%d", &x, &y)
#define scddd(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define eb emplace_back
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define IOS std::ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppp;

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double pi = 2*acos(0.0);
const double eps = 1e-13;
const ll mod = 1e9+7;
const int maxn = 2e6 + 10;
const int maxm = 50000 + 10;

ll jie[maxn];

ll qpow(ll a, ll b){
    ll res=1;
    a %= mod;
    while(b){
        if(b&1)
            res = (res*a) % mod;
        a = (a*a) % mod;
        b>>=1;
    }
    return res;
}

void init(){
    jie[0]=1;
    for(int i=1; i<maxn; i++){
        jie[i] = (jie[i-1]*i) % mod;
    }
}

void solve() {
    init();
    int a, b;
    scdd(a, b);
    int tx = 2*b-a;
    int ty = 2*a-b;
    if(tx%3 || ty%3 || tx<0 || ty<0){
        puts("0");
        return;
    }
    int x = tx/3, y = ty/3;
    ll ans = jie[x+y] * qpow(jie[x], mod-2)%mod * qpow(jie[y], mod-2)%mod;
    printf("%lld\n", ans);
}

int main() {
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    //freopen("ans.txt","w",stdout);
#endif
    //IOS;
    solve();

    return 0;
}


Measured memory_bytes: 15872