akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
    int n;
    cin >> n;
    vector<vector<int>> e(n,vector<int>(0)),d(n,vector<int>(n,inf));
    rep(i,n){
        string s;
        cin >> s;
        rep(j,n){
            if (i==j) d[i][j]=0;
            if (s[j]=='1'){
                e[i].push_back(j);
                d[i][j]=1;
            }
        }
    }
    vector<int> a(n,-1);
    a[0]=0;
    queue<pp> q;
    q.push(mk(0,0));
    while(!q.empty()){
        int c=q.front().first,v=q.front().second;
        q.pop();
        rep(i,e[c].size()){
            int t=e[c][i];
            if (a[t]==v){
                cout << -1 << endl;
                return 0;
            }
            if (a[t]==-1){
                a[t]=1-v;
                q.push(mk(t,1-v));
            }
        }
    }
    int ans=0;
    rep(r,n){
        rep(i,n){
            rep(j,n){
                d[i][j]=min(d[i][j],d[i][r]+d[r][j]);
            }
        }
    }
    rep(i,n){
        rep(j,n){
            ans=max(ans,d[i][j]);
        }
    }
    cout << ans+1 << endl;
}


Measured memory_bytes: 640
S = list(input())
ans = 0
for i in range(len(S)):
  if(i != 0):
    if(S[i] == S[i-1]):
      ans += 1
      if(S[i] == '0'):
        S[i] = '1'
      else: 
        S[i] = '0'
print(ans)     


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG




int main() {
  ll N, M;
  cin >> N >> M;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));


  
  cout << (N-1)*N/2 + (M-1)*M/2 << endl;

  return 0;
}


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

int func(int x, int r, int D){
	return r*x - D;
}

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int r, D, x;
	cin >> r >> D >> x;
	int tmp = x;
	for (int i = 0; i < 10; i++)
	{
		tmp = func(tmp, r, D);
		cout << tmp << endl;
	}
	
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>

using namespace std;

int main() {
  int k; cin >> k;
  
  long long sum = 0;
  for (int i = 1; i <= k; ++i) for (int j = 1; j <= k; ++j) for (int l = 1; l <= k; ++l)
    sum += gcd(gcd(i, j), l);
  
  cout << sum << endl;
  return 0;
}


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

int main(){
  string s;
  cin >> s;
  ll num = 0;
  ll ans = 0;
  int l = s.size();
  for(int i = l-1; i >= 0; i--) {
    if(s[i] == 'W') num++;
    else ans += num;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n;
pair<char,int> A[100000];
map<int,vector<char> > m;
int partition(int p,int r){
  int x = A[r].second;
  int i = p - 1;
  for(int j=p;j<r;j++){
    if(A[j].second <= x){
      i = i+1;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}
void MyQuickSort(int p,int r){
  if(p<r){
    int q = partition(p,r);
    MyQuickSort(p,q-1);
    MyQuickSort(q+1,r);
  }
}
int main(){
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> A[i].first >> A[i].second;
    m[A[i].second].push_back(A[i].first);
  }
  MyQuickSort(0,n-1);
  int nowpos = 0;
  int oldnum = 0;
  for(int i = 0;i < n;i++){
    if(oldnum != A[i].second)nowpos=0;
    if(m[A[i].second][nowpos] == A[i].first){
      if(i == n -1)cout <<"Stable" << endl;
      nowpos++;
      oldnum = A[i].second;
      continue;
    }
    cout << "Not stable" << endl;
    break;
  }
  for(int i = 0;i<n;i++){
    cout << A[i].first <<" " << A[i].second <<endl;
  }
  return 0;
}



Measured memory_bytes: 6540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];
    ll ans=-INF;
    ll mi=a[0];
    fore(i,1,n-1){
        chmax(ans,a[i]-mi);
        chmin(mi,a[i]);
    }
    cout<<ans<<endl;
}

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



Measured memory_bytes: 4320
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

vvll G1(200100, vll(0));
vll counter(200100, 0);
vll x(200100, 0);
vector<bool> flag(200100, true);

void query(int p, int plus){
  counter.at(p) += plus;
  flag.at(p) = false;
  for(int i = 0; i < G1.at(p).size(); i++){
    int next = G1.at(p).at(i);
    if(flag.at(next)) query(next, plus + x.at(next));
  }
}

int main(){
  ll N, Q;
  cin >> N >> Q;
  for(int i = 0; i < N-1; i++){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    G1.at(a).push_back(b);
    G1.at(b).push_back(a);
  }
  
  
  for(int i = 0; i < Q; i++){
    int pp, xx;
    cin >> pp >> xx;
    pp--;
    x.at(pp) += xx;
  }

  query(0, x.at(0));

  for(int i = 0; i < N; i++){
    cout << counter.at(i);
    if(i == N-1) cout << endl;
    else cout << ' ';
  }
}

Measured memory_bytes: 25856
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

ll gcd(ll  a,ll b) { 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
 

ll ans, mx, sum, mn = 1e8, cnt;

int main(){
	ll n,m;
	cin>>n>>m;
	for(ll i=0; i<m; i++){
		ll a;
		cin>>a;
		sum+=a;
	}
	if(sum>n) cout<<-1;
	else cout<<n-sum;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <array>

using namespace std;

int main(void){
    int N;
    long long int result=0;
    cin >> N;
    array<string,100001> s;

    for (int i=0; i < N; ++i){
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
    }

    sort(s.begin(), s.begin()+N);
s[N]="----------";

    long long int k=0;
    for (int i = 0; i < N; ++i) {
       if (s[i]==s[i+1]) {
            ++k;
        }else if(k!=0){
            result+=k*(k+1)/2;
            k=0;
        }
    }
     printf("%lld",result);

    return 0;
}


Measured memory_bytes: 7296
N, K = map(int, input().split())

if K%2 == 1:
    print((N//K)**3)
else:
    a, b = 0, 0
    for i in range(1, N+1):
        if i%K == 0:
            a += 1
        elif i%K == K//2:
            b += 1
    print(b**3+a**3)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  ll allEven = true;
  rep(i, n) if(A[i]%2) allEven = false;
  cout << (allEven ? "second" : "first") << "\n";
  return 0;
}


Measured memory_bytes: 3980
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
    int n, m;
    cin >> n >> m;

    vector<int> h(n+1);
    rep (i, 1, n) cin >> h[i];

    vector<vector<int> > adj(n+1);
    while (m--) {
    	int u, v;
    	cin >> u >> v;
    	adj[u].push_back(h[v]);
    	adj[v].push_back(h[u]);
    }

    int res = 0;
    rep (i, 1, n) {
    	int sz = adj[i].size();
    	if (sz == 0) {
    		//db1(i);
    		res++;
    		continue;
    	}
    	sort(adj[i].begin(), adj[i].end());
    	if (adj[i][sz-1] < h[i]) {
    		//db1(i);
    		res++;
    	}
    }
    cout << res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 8744
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == t[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [m, f, r] <- getInts
  ; if m == -1 && f == -1 && r == -1 then done
    else printGrade m f r
  }

done :: IO ()
done = return ()

printGrade :: Int -> Int -> Int -> IO ()
printGrade m f r = putStrLn (grade m f r) >> loop

grade :: Int -> Int -> Int -> String
grade m f r = if m == -1 || f == -1 then "F"
              else if mpf >= 80 then "A"
              else if mpf >= 65 then "B"
              else if mpf >= 50 then "C"
              else if mpf >= 30 then (if r >= 50 then "C" else "D")
              else "F"
 where
   mpf = m + f

--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords .  map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""




Measured memory_bytes: 4180
#include <stdio.h>
#include <stdlib.h>

int main(){
  int b;
  int i,j,num,v;

  scanf("%d",&num);
  int a[num];
 for(i=0; i<num; i++){
   scanf("%d",&a[i]);
 }

 for(i=0; i<num; i++){

   v = a[i];
   b = i - 1;

   while(b>=0 && a[b] > v){
     a[b+1] = a[b];
     b--;
     a[b+1] =v;
   }
   for(j=0; j<num; j++){
     if(j!=num-1)printf("%d ",a[j]);
     else{
       printf("%d",a[j]);
     }
   }
 printf("\n");
}
return 0;
}



Measured memory_bytes: 2140
import collections
n,k = map(int, raw_input().split(' '))
ais = map(int ,raw_input().split(' '))

prev = ais[::]
for _ in range(k):

	h = collections.Counter()
	for i,d in enumerate(ais):
		u = i+1
		h[max(1, u - d)] += 1
		h[u + d + 1] -= 1

	cumul = 0
	for u in range(1, n+1):
		cumul += h[u]
		ais[u - 1] = cumul
	if prev == ais[::]:
		break
	prev = ais[::]


for e in ais:print e,


Measured memory_bytes: 212196
import sys;
import itertools;

n = int(sys.stdin.readline())
a = tuple(map(int, sys.stdin.readline().split()))

prev=()
for l in itertools.permutations(sorted(a), n):
    if a==l:
        if len(prev)>0:
            print(' '.join(map(str,prev)))
        print(' '.join(map(str,a)))
    if prev==a:
        print(' '.join(map(str,l)))
    prev=l



Measured memory_bytes: 5640
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LL long long int 
const LL MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LL n,i;cin>>n;
      LL a[n];
      fo(i,0,n) cin>>a[i];
      sort(a,a+n,greater<int>());
      LL ans=a[0],x=n-2;
      fo(i,1,n){
        if(x==0) break;
        ans+=a[i];
        x--;
        if(x==0) break;
        ans+=a[i];
        x--;
        if(x==0) break;
      }
      cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 5216
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#define lld long long int
#define DBG1(vari1) cerr<<#vari1<<" = "<<(vari1)<<endl;
#define DBG2(vari1,vari2) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<endl;
#define DBG3(vari1,vari2,vari3) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<" "<<#vari3<<" = "<<(vari3)<<endl;
using namespace std;
lld dp[51][51][2510];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// freopen("input.txt", "r", stdin);  
	int n,a;
	cin >> n >> a;
	int arr[n];
	for(int i=0;i<n;i++)
		cin >> arr[i];
	int m=max(*max_element(arr,arr+n),a);
	dp[0][0][0] = 1;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
		{
			for(int k=0;k<=(m*n);k++)
			{
				if(i==0 && j==0 && k==0)
					dp[i][j][k]=1;
				else if(i>=1 && arr[i-1]>k)
					dp[i][j][k] = dp[i-1][j][k];
				else if(i>=1 && j>=1 && k>=arr[i-1])
					dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-arr[i-1]];
				else
					dp[i][j][k]=0;
			}
		}
	}
	lld ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=dp[n][i][i*a];
	}
 	cout << ans;
}

Measured memory_bytes: 51328
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	a, b, c := ReadString(), ReadString(), ReadString()
	fmt.Println(a[:1] + b[:1] + c[:1])
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
#include <cstdio>

int main()
{
  int n;
  int h[100000];
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
  {
    scanf("%d", h + i);
  }
  for (int i = n - 1; i > 0; --i)
  {
    if (h[i] - h[i - 1] <= -2)
    {
      puts("No");
      return 0;
    }
    else if (h[i] - h[i - 1] == -1)
    {
      --h[i - 1];
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 512
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	private void run() throws IOException {
		Scanner s = new Scanner(System.in);
		while(true){
			int cnt = s.nextInt();
			int sum = s.nextInt();
			if(cnt==0 && sum==0) {
				return;
			}
			int[] value = new int[cnt+1];
			for(int i=0 ; i<cnt ; i++) {
				value[i] = s.nextInt();
			}
			value[cnt] = 0;
			System.out.println(solve(value, sum));
		}
	}

	public static int solve(int[] value, int sum) {
		ArrayList<Integer> list = new ArrayList<Integer>();
		//????????¨??????
		for(int i=0 ; i<value.length ; i++) {
			for(int j=0 ; j<value.length ; j++) {
					if(value[i] + value[j] <= sum)
						list.add(value[i] + value[j]);
			}
		}
		Collections.sort(list);

		int returnValue = 0;
		//???????????????
//		for(int i=0 ; i<value.length ; i++) {
//			for(int j=0 ; j<value.length ; j++) {
		int index = list.size()-1;
		for(int i=0 ; i<list.size() ; i++) {
			while(list.get(i) + list.get(index) > sum)
				index--;
			returnValue = Math.max(list.get(i) + list.get(index), returnValue);
//				if(sum < (Integer)objList[i])
//					continue;
//				int remainSum = sum - ((Integer)objList[i]);
//				int start = 0;
//				int end = objList.length -1;
//				int mid=0;
//				while(start<=end) {
//					mid = (start+end) / 2;
//					if((Integer)objList[mid]>remainSum) {
//						end = mid-1;
//					}else if((Integer)objList[mid]<remainSum) {
//						start = mid+1;
//					}else {
//						break;
//					}
//				}
//				if(remainSum<(Integer)objList[mid])
//					returnValue = Math.max(returnValue, ((Integer)objList[mid-1] + (Integer)objList[i]));
//				else
//					returnValue = Math.max(returnValue, ((Integer)objList[mid] + (Integer)objList[i]));
		}
		return returnValue;
	}
}

Measured memory_bytes: 140072
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1000000007;
const llint big=1e9+1e8;
const llint red=0xE869120;
const llint pro=1002001;
int main(void){
	int i,j,n,x;
	string s,t;
	cin>>s>>t;
	if(s.size()>t.size()){cout<<"GREATER"<<endl;return 0;}
	if(t.size()>s.size()){cout<<"LESS"<<endl;return 0;}
	if(s>t){cout<<"GREATER"<<endl;return 0;}
	if(t>s){cout<<"LESS"<<endl;return 0;}
	cout<<"EQUAL"<<endl;
	return 0;
}

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

#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x=0,num=0;
    cin>>n;
    ll a[n],b[n]={0},c[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i+num<n;i++){
        c[i]=a[i+num];
        if(i+num!=n-1){
            if(a[i+num]==a[i+num+1]){
                b[i]++;
                num++;
                i--;
            }
        }
    }
    for(int i=0;i<n-num;i++){
        b[i]++;
    }
    for(int i=n-num-1;i>=0;i--){
        if(x!=0){
            if(b[i]>=2){
                cout << x*c[i]<<endl;
                return 0;
            }
        }
        else{
            if(b[i]>=4){
                cout << c[i]*c[i]<<endl;
                return 0;
            }
            else if(b[i]>=2){
                x=c[i];
            }
        }
    }
    cout << 0<<endl;
    return 0;
}



Measured memory_bytes: 2560
import heapq
N_baito,M_days = map(int,input().split())
hosyuList = [[] for _ in range(M_days)]

for _ in range(N_baito):
    days,hosyu = map(int,input().split())
    if days <= M_days:
        hosyuList[days-1].append(hosyu)

workList = []
hosyu = 0
for day in range(M_days):
    for baito in hosyuList[day]:
        heapq.heappush(workList,-1*baito)
    if workList:
        hosyu += heapq.heappop(workList)
print(-1*hosyu)


Measured memory_bytes: 18376
#include <iostream>

void print_chess(int height, int width);

int main(void)
{
    int height, width;
    while (true) {
        std::cin >> height;
        std::cin >> width;
        if (height == 0 && width == 0) {
            break;
        }
        print_chess(height, width);
    }
    return 0;
}

void print_chess(int height, int width)
{
    int i, j;
    for (i = 0; i < height; ++i) {
        if (i % 2 == 0) {
            for (j = 0; j < width; ++j) {
                if (j % 2 == 0 && j != width - 1) {
                    std::cout << "#";
                } else if (j % 2 == 1 && j != width - 1) {
                    std::cout << ".";
                } else if (j % 2 == 0 && j == width - 1) {
                    std::cout << "#" << std::endl;
                } else if (j % 2 == 1 && j == width - 1) {
                    std::cout << "." << std::endl;
                }
            }
         } else if (i % 2 == 1) {
            for (j = 0; j < width; ++j) {
                if (j % 2 == 0 && j != width - 1) {
                    std::cout << ".";
                } else if (j % 2 == 1 && j != width - 1) {
                    std::cout << "#";
                } else if (j % 2 == 0 && j == width - 1) {
                    std::cout << "." << std::endl;
                } else if (j % 2 == 1 && j == width - 1) {
                    std::cout << "#" << std::endl;
                }
            }
        }
    }
    std::cout << "" << std::endl;
}

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

long long int DP[100000][3][3] = {};
long long int INF = 998244353;

long long int pow(int n, int m){
	long long int ret = 1;
	for(int i = 0; i < m; i++){
		ret *= n;
		ret %= INF;
	}
	return ret;
}

int main() {
	
	string str;
	cin >> str;
	long long int ans = 0;
	bool flag = true;
	for(int i = 0; i < str.size() - 1; i++){
		if(str[i] != str[i + 1]){
			flag = false;
		}
	}
	if(flag){
		cout << "1" << endl;
		return 0;
	}
	if(str.size() == 3){
		if(str[0] != str[1] && str[2] != str[1] && str[0] != str[2]){
			cout << "3" << endl;
		}else if(str[0] == str[2]){
			cout << "7" << endl;
		}else{
			cout << "6" << endl;
		}
		return 0;
	}
	if(str.size() % 3 != 0){
		
		bool flag = true;
		for(int i = 0; i < str.size() - 1; i++){
			if(str[i] == str[i + 1]){
				flag = false;
			}
		}
		
		ans = pow(3, str.size() - 1);
		
		ans -= pow(2, str.size() - 1);
		
		if(flag){
			ans++;
		}
		
	}else{
		DP[1][0][0] = 2;
		DP[1][1][0] = 2;
		DP[1][2][0] = 2;
		DP[1][0][1] = 1;
		DP[1][1][1] = 1;
		DP[1][2][1] = 1;
		DP[1][0][2] = 1;
		DP[1][1][2] = 1;
		DP[1][2][2] = 1;
		for(int i = 1; i < str.size() / 3; i++){
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < 3; k++){
					DP[i + 1][j][k] = DP[i][j][k] * 2;
					DP[i + 1][j][k] += DP[i][(j + 1) % 3][k];
					DP[i + 1][j][k] += DP[i][(j + 2) % 3][k];
					DP[i + 1][j][k] += DP[i][(j + 1) % 3][(k + 1) % 3];
					DP[i + 1][j][k] += DP[i][(j + 2) % 3][(k + 1) % 3];
					DP[i + 1][j][k] += DP[i][(j + 1) % 3][(k + 2) % 3];
					DP[i + 1][j][k] += DP[i][(j + 2) % 3][(k + 2) % 3];
					DP[i + 1][j][k] %= INF;
				}
			}
		}
		int rest = 0;
		bool flag = true;
		for(int i = 0; i < str.size() - 1; i++){
			rest += str[i] - 'a';
			if(str[i] == str[i + 1]){
				flag = false;
			}
		}
		rest += str[str.size() - 1] - 'a';
		rest %= 3;
		
		ans = pow(3, str.size() - 1);
		
		ans -= DP[str.size() / 3][0][rest];
		ans -= DP[str.size() / 3][1][rest];
		ans -= DP[str.size() / 3][2][rest];
		
		if(flag){
			ans++;
		}
		
	}
	
	ans += INF * 100;
	ans %= INF;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 6660
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

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

		List<Integer> A = new ArrayList<Integer>();
		for(int i=0; i<3; i++){
			A.add(Integer.parseInt(sc.next()));
		}

		Collections.sort(A);

		System.out.println(A.get(2) - A.get(0));
	}
}


Measured memory_bytes: 22996
#include <algorithm>
#include <cassert>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

struct Rat {
    long a, b;

    bool operator<(const Rat& other) const {
        return a * other.b < other.a * b;
    }
};

int main()
{
    long A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    Rat best{0, 100 * A};
    map<pair<long, long>, bool> visited;

    deque<pair<long, long>> q;
    q.push_back(make_pair(0, 0));

    while (!q.empty()) {
        long w, s;
        tie(w, s) = q.front();
        q.pop_front();

        if (w + s > F)
            continue;
        if (w / 100 * E < s)
            continue;
        if (visited[make_pair(w, s)])
            continue;

        visited[make_pair(w, s)] = true;

        if (best < Rat{s, w + s})
            best = Rat{s, w + s};

        q.push_back(make_pair(w + 100 * A, s));
        q.push_back(make_pair(w + 100 * B, s));
        q.push_back(make_pair(w, s + C));
        q.push_back(make_pair(w, s + D));
    }

    cout << best.b << ' ' << best.a << '\n';

    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
string s;
int n;
bool sp[100000];//0羊,1狼 
bool ok;
int main()
{
	cin>>n>>s;
	for(int f=0;f<2;f++)
	{
		for(int e=0;e<2;e++)
		{
			sp[0]=f;
			sp[1]=e;
			for(int l=2;l<n;l++)
			{
				if(sp[l-1])
				{
					if(s[l-1]=='x')sp[l]=sp[l-2];
					else if(s[l-1]=='o')sp[l]=1^sp[l-2];
				}
				else 
				{
					if(s[l-1]=='x')sp[l]=1^sp[l-2];
					else if(s[l-1]=='o')sp[l]=sp[l-2];
				}
			}
			if(sp[0]==1&&((s[0]=='o'&&sp[n-1]!=sp[1])||(s[0]=='x'&&sp[n-1]==sp[1])))
			{
				if(sp[n-1]==1&&((s[n-1]=='o'&&sp[n-2]!=sp[0])||(s[n-1]=='x'&&sp[n-2]==sp[0])))ok=1;
				else if(sp[n-1]==0&&((s[n-1]=='o'&&sp[n-2]==sp[0])||(s[n-1]=='x'&&sp[n-2]!=sp[0])))ok=1;
			}
			else if(sp[0]==0&&((s[0]=='o'&&sp[n-1]==sp[1])||(s[0]=='x'&&sp[n-1]!=sp[1])))
			{
				if(sp[n-1]==1&&((s[n-1]=='o'&&sp[n-2]!=sp[0])||(s[n-1]=='x'&&sp[n-2]==sp[0])))ok=1;
				else if(sp[n-1]==0&&((s[n-1]=='o'&&sp[n-2]==sp[0])||(s[n-1]=='x'&&sp[n-2]!=sp[0])))ok=1;
			}
			if(ok)
			{
				for(int i=0;i<n;i++)
				{
					if(sp[i])cout<<"W";
					else cout<<"S";
				}
				return 0;
			}
		}
	}
	cout<<"-1";
	return 0;
}

Measured memory_bytes: 640
"use strict";

function main(arg) {
    const N = arg.split("\n")[0].split("");

    if(N[0] == N[1] && N[1] == N[2] || N[1] == N[2] && N[2] == N[3]) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class BPapersPlease {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.readIntArray(n);

            boolean answer = true;
            for (int x : a) {
                answer &= x % 2 == 1 || x % 3 == 0 || x % 5 == 0;
            }
            out.println(answer ? "APPROVED" : "DENIED");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}



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

using namespace std;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    int odd = 0, even = 0;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if (a % 2)
            odd++;
        else
            even++;
    }
    if (odd == 0 || even == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    int ret = even + (odd - 1) / 2 * 2;
    cout << ret << endl;
}



Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int n,a[200003],allxor=0;
int main(void)
{
  	cin>>n;
  	for(int i=0;i<n;i++)
    {
      	cin>>a[i];
  		allxor^=a[i];
    }
  	for(int i=0;i<n;i++)
  		cout<<(a[i]^allxor)<<' ';
}

Measured memory_bytes: 4384
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main(){
	while(true){
		int H,W;
		cin >> H >> W;
		if(H == 0 && W == 0) break;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cout << "#";
			}
			cout << endl;
		}
		
		cout << endl;
		
	}
}





Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

int main(){
	FAST;

	int N;
	cin >> N;

	vector<int> A(N);

	int n;
	rep(i,N) {
		cin >> n;
		A[n-1] = i+1;
	}

	rep(i,N) cout << A[i] << " ";
	cout << LF;

	return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <list>
#include <iostream>
using namespace std;

struct TreeNode{
  int parent;
  int depth;
  list<int> children;
  TreeNode(){
    parent = -1;
    depth  = 0;
  }
};

int main(){
  TreeNode tree[100000];
  int n;
  cin >> n;
  for (int i=0;i<n;++i){
    int id, m;
    cin >> id >> m;
    for (int j=0;j<m;++j){
      int temp;
      cin >> temp;
      tree[id].children.push_back(temp);
      tree[temp].parent = id;
      tree[temp].depth  = tree[id].depth+1;
    }
  }
  for (int i=0;i<n;i++){
    if (tree[i].parent != -1)
      tree[i].depth = tree[tree[i].parent].depth+1;
    cout << "node " << i << ": parent = " << tree[i].parent << ", depth = " << tree[i].depth ;;
    if (tree[i].parent == -1){
      cout << ", root, ";
      if (tree[i].children.empty()) cout << "[";
      for (auto ite=tree[i].children.begin();ite!=tree[i].children.end();ite++)
        cout << (ite == tree[i].children.begin()?"[":", ") << *ite;
      cout << "]" << endl;
    }
    else if (!tree[i].children.empty()){
      cout << ", internal node, ";
      for (auto ite=tree[i].children.begin();ite!=tree[i].children.end();ite++)
        cout << (ite == tree[i].children.begin()?"[":", ") << *ite;
      cout << "]" << endl;
    }
    else {
      cout << ", leaf, []" << endl;
    }
  }
}



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

int n, k;
set<int> a;
vector<bool> DP;

int main()
{
	cin >> n >> k;
	int b;
	for (int i = 0; i < n; i++)
	{
		cin >> b; a.insert(b);
	}

	// DP[i] is 1 if first player can win (1st's turn, i stones in the pile)
	DP.resize(k + 1);

	for (int i = 0; i < k+1; i++)
	{
		// not enough to make a move for current player lose (0)
		// exact amount for one of the move win (1)
		// play all possible move and see if any can lead to a win
		if (i < *(a.begin()))
		{
			DP[i] = false;
			continue;
		}
		if (a.find(i) != a.end())
		{
			DP[i] = true;
			continue;
		}
		int tmp = false;
		for (auto x : a)
		{
			if (x < i)
				tmp |= (!DP[i - x]);
		}
		DP[i] = tmp;
	}
	if (DP[k])
		cout << "First" << endl;
	else
		cout << "Second" << endl;
}

Measured memory_bytes: 3652
n,k,q = input().split(' ')
a = [int(k) for i in range(int(n))]
for i in range(int(q)):
    a[int(input())-1] += 1
for i in range(int(n)):
    if a[i] > int(q):
        print('Yes')
    else:
        print('No')

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

#define F first
#define S second

using namespace std;
typedef long double ld;
typedef long long ll;

const int max_n = 200011, inf = 1000111222;
const ll inff = 1000111222333444;

int n, m, used[max_n], d[max_n];
vector<int> v[max_n];

bool dfs(int x, int p) {
    vector<int> k;
    used[x] = 1;
    d[x] = p == -1 ? 1 : d[p] + 1;
    for (int to : v[x]) {
        if (to == p) continue;
        if (used[to]) {
            if (d[x] < d[to]) {
                k.push_back(to);
            }
            continue;
        }
        if (dfs(to, x)) k.push_back(to);
    }
    for (int i = 0; i < k.size(); ++i) {
        printf("%d %d\n", x + 1, k[i] + 1);
    }
    // cout << x << ": "; for (int to : k) cout << to << ", "; cout << endl;
    if (k.size() % 2 != 0) {
        assert(p != -1);
        printf("%d %d\n", x + 1, p + 1);
        return false;
    }
    return true;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int x, y;
        scanf("%d%d", &x, &y);
        --x; --y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    if (m % 2 != 0) {
        cout << -1 << endl;
        return 0;
    }
    dfs(0, -1);
    return 0;
}


Measured memory_bytes: 19968
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   while(a>0 || c>0)
   {
      c = c - b;
      if(c<=0)
      {
        cout<<"Yes"<<endl;break;
      }
      a =a-d;
      if(a<=0)
      {
         cout<<"No"<<endl;break;
      }
   }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c;
  int a[20][20], b[20];
  scanf("%d%d%d", &n, &m, &c);
  for (int i = 0; i < m; i++) {
    scanf("%d", b + i);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int res = 0;
    for (int j = 0; j < m; j++) res += a[i][j] * b[j];
    if (res + c > 0) ans++;
  }
  printf("%d\n", ans);
}


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

long long n,m;
long long dp[101000],ans[101000];
vector <int> v[101000];
int fa[101000];
int k;

void gao(int x){
	for(int i=0;i!=v[x].size();++i){
		if(fa[x]==v[x][i]) continue;
		fa[v[x][i]]=x;
		gao(v[x][i]);
	}
}

long long suan(int x){
	if(dp[x]!=-1)	return dp[x];
	dp[x]=1;
	for(int i=0;i!=v[x].size();++i){
		if(v[x][i]==fa[x]) continue;
		dp[x]*=suan(v[x][i])+1;
		dp[x]%=m;
	}
	return dp[x];
}

void nong(int x){
	int l=v[x].size();
	long long le[l+5],ri[l+5];
	le[0]=1;ri[l+1]=1;
	for(int i=1;i<=l;++i) le[i]=le[i-1]*(dp[v[x][i-1]]+1)%m;
	for(int i=l;i>=1;--i) ri[i]=ri[i+1]*(dp[v[x][i-1]]+1)%m;
	for(int i=0;i<v[x].size();++i){
		if(ans[v[x][i]]!=-1) continue;
		fa[x]=v[x][i];
		fa[v[x][i]]=0;
		long long tmp1=dp[x],tmp2=dp[v[x][i]];
		dp[x]=le[i]*ri[i+2]%m;
		
		/*for(int j=0;j<v[x].size();++j) {
			if(v[x][j]==fa[x]) continue;
			dp[x]*=dp[v[x][j]]+1;
			dp[x]%=m;
		}*/
		dp[v[x][i]]*=dp[x]+1;
		dp[v[x][i]]%=m;
		ans[v[x][i]]=dp[v[x][i]];
		nong(v[x][i]);
		fa[v[x][i]]=x;
		fa[x]=0;
		dp[x]=tmp1;
		dp[v[x][i]]=tmp2;
	}
	
}

int main(){
	cin>>n>>m;
	memset(ans,-1,sizeof(ans));
	memset(dp,-1,sizeof(dp));
	for(int i=1;i<n;++i){
		int a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	if(n==1) cout<<1<<"\n",exit(0);
	k=n/2;
	for(int i=1;i<=n;++i){
		if(v[i].size()==1&&i!=k) 	dp[i]=1;
		}
	gao(k);
	suan(k);
	ans[k]=dp[k];
	nong(k);
	for(int i=1;i<=n;++i) cout<<ans[i]<<"\n";
	return 0;
}

Measured memory_bytes: 31104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=998244353;
int a[3005][3005];
ll dp[3005][3005][5];


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r,c,k;
    cin>>r>>c>>k;
    while(k--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        a[x][y]=z;
    }
    ll ans=0;
    /*for(int i=1;i<=r;i++)
    {
        dp[i][1][0]=dp[i-1][1][1];
        dp[i][1][1]=dp[i-1][1][1]+a[i][1];
        ans=max(ans,dp[i][1][1]);
    }
    for(int i=1;i<=c;i++)
    {
        for(int x=1;x<=3;x++)
        {
            dp[1][i][x]=max(dp[1][i-1][x],dp[1][i-1][x-1]+a[1][i]);
            ans=max(ans,dp[1][i][x]);
        }
    }*/

    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            dp[i][j][0]=max(dp[i][j-1][0],dp[i-1][j][3]);
            ans=max(ans,dp[i][j][0]);
            for(int x=1;x<=3;x++)
            {
                dp[i][j][x]=max(dp[i-1][j][3]+a[i][j],max(dp[i][j-1][x],dp[i][j-1][x-1]+a[i][j]));
                ans=max(ans,dp[i][j][x]);
            }
        }
    }
    cout<<ans<<'\n';


}


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

int n,m,q,x[55],y[55],z[55],w[55];
int a[55],ans;

void dfs(int dep,int lst)
{
	if(dep==n+1)
	{
		int res=0;
		for(int i=1;i<=q;i++)
		{
			if(a[y[i]]-a[x[i]]==z[i]) res+=w[i];
		}
		ans=max(ans,res);
		return;
	}
	for(int i=lst;i<=m;i++)
	{
		a[dep]=i;
		dfs(dep+1,i);
	}
}

int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d%d%d",&x[i],&y[i],&z[i],&w[i]);
	}
	a[1]=1;
	dfs(2,1);
	printf("%d\n",ans);
}

Measured memory_bytes: 3816
s = gets.to_i
a = []
a[1] = s
i = 2
while true do
  if a[i-1] % 2 == 0
    tmp = a[i-1] / 2
  else
    tmp = 3 * a[i-1] + 1
  end
  break if a.include?(tmp)
  a[i] = tmp
  i += 1
end
puts i


Measured memory_bytes: 1788
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <utility>
using namespace std;
#define omajinai ios::sync_with_stdio(false);cin.tie(nullptr);

#pragma region typedef 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ld PI = 3.141592653589793;
const ll INF18 = 1e18;
#pragma endregion

#pragma region function
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;}
#pragma endregion



int main() {
omajinai;

  int a, b;
  cin >> a >> b;
  cout << a*b << endl;
return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int n;cin>>n;
    string s;cin>>s;
    int res = 0;
    vector<map<char,int>>mp(n);
    vector<set<char>>set(n);
    rep(i,n){
        if(i==0)continue;
        string t = s.substr(0,i),u = s.substr(i,n-i);
        rep(j,i)set[i].insert(t[j]);
        int cnt = 0;
        rep(j,n-i){
            if(mp[i][u[j]])continue;
            mp[i][u[j]] = 1;
            cnt += set[i].count(u[j]);
        }
        res = max(res,cnt);
    }
    cout<<res<<endl;
}



Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
    char B;
  
    scanf("%c",&B);
    
    if(B=='A') printf("T\n");
    if(B=='C') printf("G\n");
    if(B=='G') printf("C\n");
    if(B=='T') printf("A\n");
  
    return 0;
}

Measured memory_bytes: 1564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
lint lcm(lint a,lint b){
      return a/__gcd(a,b)*b;
  }
 
  int main(){
      set <lint> x;
      lint a,b,c;
      cin>>a>>b>>c;
        x.insert(a);
          x.insert(b);
            x.insert(c);
            cout<<x.size();


}


Measured memory_bytes: 256
N, M = map(int, input().split())

_number = []
P = []
Y = []
yp = [[] for i in range(N+1)]
_yp = []

for i in range(M):
    p, y = map(int, input().split())
    yp[p].append([y, i])

# print(yp)

_l_yp = len(yp)

for i in range(_l_yp):
    yp[i].sort()


ans_yp = [[] for i in range(M)]

for i in range(_l_yp):
    nga_yp = len(yp[i])

    for j in range(nga_yp):
    #    print(i, j)
    #    print(yp[i][j][1])
       ans_yp[yp[i][j][1]].append(i)
       ans_yp[yp[i][j][1]].append(j+1)


__len = len(ans_yp)

for i in range(__len):
    buff = ''
    for d in range(2):
        ans = ''
        for j in range((6-len(str(ans_yp[i][d])))):
            ans += '0'

        buff += ans + str(ans_yp[i][d])

    print(buff)


Measured memory_bytes: 46888
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define getcx getchar_unlocked
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 100005
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

vector<int> vec[1001];
int h, w, cx, cy, dx, dy, ans[1001][1001];
char s[1001][1001];

priority_queue<pair<int, pair<int,int> >, vector<pair<int, pair<int,int> > >, greater<pair<int, pair<int,int> > > > pq;

bool isValid(int x, int y) {
	return x >=0 && x < h && y >=0 && y < w && s[x][y] == '.';
}

void dijsktra(int sx, int sy) {

	ans[sx][sy] = 0;
	pq.push(MP(0, MP(sx, sy)));

	while(!pq.empty()) {

		int currcost = pq.top().first;
		int currx = pq.top().second.first;
		int curry = pq.top().second.second;
		pq.pop();

		//cout<<currx << " " <<curry<< " " <<currcost << endl;

		int nextx, nexty, newcost;
		nextx = currx - 1;
		nexty = curry;
		newcost = currcost;

		if(isValid(nextx, nexty) && newcost < ans[nextx][nexty]) {
			ans[nextx][nexty] = newcost;
			pq.push(MP(newcost, MP(nextx, nexty)));
		}
		
		nextx = currx + 1;
		nexty = curry;
		
		if(isValid(nextx, nexty) && newcost < ans[nextx][nexty]) {
			ans[nextx][nexty] = newcost;
			pq.push(MP(newcost, MP(nextx, nexty)));
		}

		nextx = currx;
		nexty = curry - 1;
		
		if(isValid(nextx, nexty) && newcost < ans[nextx][nexty]) {
			ans[nextx][nexty] = newcost;
			pq.push(MP(newcost, MP(nextx, nexty)));
		}

		nextx = currx;
		nexty = curry + 1;
		
		if(isValid(nextx, nexty) && newcost < ans[nextx][nexty]) {
			ans[nextx][nexty] = newcost;
			pq.push(MP(newcost, MP(nextx, nexty)));
		}

		for(int i = -2; i <=2 ;i++) {
			for(int j = -2; j <= 2; j++) {
				if(!(i ==0 && j==0)) {
					nextx = currx + i;
					nexty = curry + j;
					newcost = currcost + 5;

					if(isValid(nextx, nexty) && newcost < ans[nextx][nexty]) {
						ans[nextx][nexty] = newcost;
						pq.push(MP(newcost, MP(nextx, nexty)));
					}
				}
			}
		}
	}
}

int main() {

	int i, j, k;

	in2(h,w);
	in2(cx,cy);
	in2(dx, dy);

	for(i = 0; i < h; i++) {
		scanf("%s", s[i]);
	}

	for(i = 0; i < h; i++) {
		for(j = 0; j < w; j++) {
			ans[i][j] = INF;
		}
	}

	dijsktra(cx-1, cy-1);

	if(ans[dx-1][dy-1] == INF) cout<<"-1"<<en;
	else cout<<ans[dx-1][dy-1]/5<<en;

	return 0;
}

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

typedef long long ll;

int main() {
    int K;
    int A, B;
    cin >> K;
    cin >> A >> B;
    for (int i = A; i <= B; i++) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3628
#include <math.h>
#include <stdio.h>

#include <iostream>
#include <string>

using namespace std;

bool IsPrime(int num) {
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;  // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main() {
    long long int X;
    cin >> X;

    while (true) {
        for (int i = 0; i < 100001; i++) {
            if (IsPrime((X + i))) {
                cout << X + i << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
  if(x-r < 0 || x+r > W || y-r < 0 || y+r > H){
    printf("No\n");
  } else {
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 584