akhauriyash/Code-Regression huggingface dataset:
# include "bits/stdc++.h"
 
using namespace std;
 
#define endl "\n"
typedef long long int ll;
#define f first
#define s second
 
#define SEND_HELP ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
inline void setPrecision(int n){cout.precision(n);}
 
//DEBUG
#define BR cerr<<endl
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
 
ll INF = 1e10;
int MOD = 1e9+7;

int main(){
	#ifndef ONLINE_JUDGE
        freopen("inputf.in", "r", stdin);
    #endif
    SEND_HELP

    int n;
    cin >> n;
    vector<pair<int, int>> d(n);
    for(int i = 0; i < n; ++ i){
    	cin >> d[i].s >> d[i].f;
    }
    sort(d.begin(), d.end());
    int cur = 0;
    bool can = 1;
    for(int i = 0; i < n; ++ i){
    	cur += d[i].s;
    	if(cur > d[i].f){
    		can = 0;
    		break;
    	}
    }
    if(can){
    	cout << "Yes";
    }
    else{
    	cout << "No";
    }
    return 0;
}

/*

*/

Measured memory_bytes: 4784
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;



    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        int a = 0;
        int b = S.Length - 1;
        int ans = 0;
        while(a < b)
        {
            if(S[a] == S[b])
            {
                a++; b--; continue;
            }
            if(S[a] == 'x')
            {
                ans++; a++; continue;
            }
            if(S[b] == 'x')
            {
                ans++; b--; continue;
            }
            Console.WriteLine("-1"); return;
        }
        Console.WriteLine(ans);
    }

}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13664
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int A, B, K;
  cin >> A >> B >> K;

  A -= K;
  if(A < 0){
    B += A;
    A = 0;
  }
  if(B < 0) B = 0;

  cout << A << " " << B << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int M , D ;
    cin  >> M >> D ;
    int counter = 0 ;
    for (int  x = 2 ; x <= 9 ;  x++ ){
        for (int y = 2 ; y <= 9 ; y++){
            if ( 10*x + y <= D && x*y <= M ){
                counter++;
            }
        }
    }
    cout << counter << endl;
}

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

using namespace std;

bool Test(const string& s) {
  if (s[0] != 'A')
    return false;

  int cnt = 0;
  int index = 0;
  for (int i = 2; i <= s.size() - 2; i++) {
    if (s[i] == 'C') {
      ++cnt;
      index = i;
    }
  }
  if (cnt != 1) return false;

  for (int i = 1; i < s.size(); i++) {
    if (i == index) continue;
    if ('A' <= s[i] && s[i] <= 'Z')
      return false;
  }
  return true;
}

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

  if (Test(s)) {
    cout << "AC" << endl;
  } else {
    cout << "WA" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<math.h> 
#include<algorithm> 
#include<stdio.h> 
#include<sstream>
#include<fstream>  
using namespace std; 
typedef long long ll; 
typedef long double ld; 

int ceil(int a, int m){
    // division of a and m
    if(a % m == 0){
        return a/m; 
    }
    else{
        return a/m + 1; 
    }
}

vector<int> sort(vector<int> arr){
    sort(arr.begin(), arr.end()); 
    return arr; 
}

int minInVector(vector<int> arr){
    int mins = 1e9; 
    for(int i = 0; i<arr.size(); i++){
        mins = min(mins, arr[i]); 
    }
    return mins; 
}

int maxInVector(vector<int> arr){
    int maxs = -1; 
    for(int i = 0; i<arr.size(); i++){
        maxs = max(maxs, arr[i]); 
    }
    return maxs; 
}

bool checkElement(vector<int> arr, int k){
    for(int i = 0; i<arr.size(); i++){
        if(arr[i] == k){
            return true; 
        }
    }
    return false; 
}



const int MOD = 1e9 + 7; 

int main(){

ios_base::sync_with_stdio(false);
cin.tie(NULL); 

char nl = '\n'; 
char bl = ' ';
/*
For array arr use the following preamble to sort
int diff = sizeof(arr)/sizeof(arr[0]); 
sort(arr, arr + diff); 

*/

char a,b,c; 
 
 cin >> a >> b >> c; 

 if(a == 'R' && b == 'R' && c == 'R'){
     cout << 3; 
 }
 else if((a=='R' && b == 'R') || (b == 'R' && c == 'R')){
     cout << 2; 
 }
 else if(a == 'R' || b == 'R' || c == 'R'){
     cout << 1; 
 }
 else{
     cout << 0; 
 }

}



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

using namespace std;

#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;
const int MAXN = (int)3e5+1;

void setIO(string name)
{
    freopen((name+".in").c_str(),"r",stdin);
    freopen((name+".out").c_str(),"w",stdout);
}

vector<int> hcuts;
bool isCut[10];
string arr[11];
int h, w, k;
int ans = 10001;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //setIO("");
    cin >> h >> w >> k;
    for(int i=0; i<h; i++)
    {
        cin >> arr[i];
    }
    for(int i=0; i<(1<<(h-1)); i++)
    {
        for(int j=0; j<h-1; j++)
        {
            if((1<<j)&i)
            {
                hcuts.PB(j);
            }
        }
        int siz = hcuts.size();
        int num[siz+1], prev_num[siz+1], ind = 0, ctr = 0;
        for(int i=0; i<=siz; i++)
        {
            num[i] = prev_num[i] = 0;
        }

        bool can = true;
        for(int j=0; j<w; j++)
        {
            ind = 0;
            bool need = false;
            for(int m=0; m<h; m++)
            {
                num[ind] += (arr[m][j] == '1');
                if(siz != 0 && hcuts[ind] == m)
                {
                    ind++;
                }

            }
            //cout << ind << "\n";
            for(ind=0; ind<=siz; ind++)
            {
                if(num[ind] - prev_num[ind] > k)
                {
                    can = false;
                    break;
                }
                if(num[ind] > k)
                {
                    need = true;
                }
            }
            if(!can)
                break;

            if(need)
            {
                for(ind = 0; ind <= siz; ind++)
                {
                    num[ind] -= prev_num[ind];
                }
                ctr++;
            }
            for(ind =0; ind <= siz; ind++)
            {
                prev_num[ind] = num[ind];
            }
        }
        hcuts.clear();
        if(!can)
            continue;
        ans = min(ans, ctr + siz);
    }

    cout << ans;


    return 0;
}



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

using namespace std;

using ll = long long;

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

    int h, w;
    cin >> h >> w;

    vector<string> maze(h);
    for (auto &&y : maze) cin >> y;

    constexpr int MOD = 1e9 + 7;
    vector<vector<int>> cnt(h, vector<int>(w));
    cnt[0][0] = 1;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (i + 1 < h && maze[i + 1][j] == '.')
                cnt[i + 1][j] = (cnt[i + 1][j] + cnt[i][j]) % MOD;
            if (j + 1 < w && maze[i][j + 1] == '.')
                cnt[i][j + 1] = (cnt[i][j + 1] + cnt[i][j]) % MOD;
        }
    }

    cout << cnt[h - 1][w - 1] << endl;

    return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P>> vec;
// vector<vector<int>> data(3, vector<int>(4));

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> d(K);
    vector<vector<ll>> A(K, vector<ll>(101));
    vector<bool> res(101);
    rep(i, K) {
        cin >> d[i];
        rep(j, d[i]) {
            cin >> A[i][j];
            A[i][j]--;
            res[A[i][j]] = true;
        }
    }
    ll r = 0;
    rep(i, N) {
        if (!res[i]) r++;
    }
    cout << r << endl;
    return 0;
}


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

#define int long long int
#define double long long double
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define endl "\n"

int32_t main()
{
	IOS;
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans = 0, cnt = 0;

	cnt += min(a, k);
	ans += cnt;
	int rem = k - cnt;
	if (rem > 0)
	{
		cnt += min(rem, b);
	}
	rem = k - cnt;
	if (rem > 0)
	{
		cnt += min(rem, c);
		ans -= min(rem, c);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3652
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions
struct UnionFind {
    par: Vec<usize>,
    rank: Vec<usize>,
}

impl UnionFind {
    fn new(n:usize) -> UnionFind {
        UnionFind {
            par: (0..n+1).collect(),
            rank: vec![0; n+1],
        }
    }
    fn find(&mut self, x:usize) -> usize {
        if self.par[x] == x {
            return x;
        }else{
            let parx = self.par[x];
            self.par[x] = self.find(parx);
            return self.par[x];
        }
    }
    fn unite(&mut self, x:usize, y:usize) {
        let x = self.find(x);
        let y = self.find(y);
        if self.rank[x] < self.rank[y] {
            self.par[x] = y;
        }else{
            self.par[y] = x;
            if self.rank[x] == self.rank[y] {
                self.rank[x] += 1;
            }
        }
    }
    fn check(&mut self, x:usize, y:usize) -> bool {
        return self.find(x) == self.find(y);
    }
}

// Main
fn main(){
    input!{
        N: usize,
        K: usize,
        L: usize,
        PQ: [(usize,usize); K],
        RS: [(usize,usize); L],
    }
    // 道路
    let mut A = UnionFind::new(N);
    for i in 0..K{
        let (x,y) = PQ[i];
        A.unite(x,y);
    }
    // 鉄道
    let mut B = UnionFind::new(N);
    for i in 0..L{
        let (x,y) = RS[i];
        B.unite(x,y);
    }
    // (道路グループ,鉄道のグループ) の組を集計
    let mut map = HashMap::new();
    for i in 1..N+1{
        *map.entry((A.find(i), B.find(i))).or_insert(0) += 1;
    }
    // 出力
    for i in 1..N+1{
        print!("{} ", map.get(&(A.par[i],B.par[i])).unwrap());
    }
}

Measured memory_bytes: 28972
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

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

int main() {
    int N,Q;
    string s;
    int l[100010],r[100010];
    int a[100010];
    cin>>N>>Q;
    cin>>s;
    for(int i=0;i<Q;i++){
        cin>>l[i]>>r[i];
    }
    int cnt=0;
    a[0]=0;
    for(int i=1;i<N;i++){
        if(s[i-1]=='A' && s[i]=='C'){
                cnt++;
                a[i]=cnt;
        }
        else {a[i]=cnt;}
        //cout<<a[i+1]<<endl;
    }
    for(int i=0;i<Q;i++){
        /*if(s[l[i]-2]=='A' && s[l[i]-1]=='C'){
            cout<<a[r[i]]-a[l[i]-1]-1<<endl;
        }*/
         cout<<a[r[i]-1]-a[l[i]-1]<<endl;
    }



    return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9 + 7;

int dp[(1 << 17)];//各ステージのクリア状況

int main() {

	int n;
	while (cin >> n, n)
	{
		vector<vector<int> > a(n, vector<int>(n + 1));
		vector<int> m(n);//無装備でかかる時間

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j <= n; j++)
			{
				cin >> a[i][j];
				if (j == 0) {
					m[i] = a[i][j];
				}
			}
		}
		memset(dp, INF, sizeof(dp));
		dp[0] = 0;

		for (int mask = 0; mask < (1 << n); mask++)
		{
			//各ステージのクリア状況

			for (int i = 0; i < n; i++)
			{
				if ((mask >> i) & 1)
				{
					//iビット目が立っている場合はステージiはクリアされている
					continue;
				}
				//以下はステージjがまだクリアされていない場合
				//cnt:ステージiをクリアするために必要な最小の時間
				int cnt = a[i][0];//無装備で初期化


				for (int j = 0; j < n; j++)
				{
					if (((mask >> j) & 1) == 0)
					{
						//まだ装備が解放されていない
						continue;
					}
					//装備が解放されている場合は解放されている装備の中で最小の時間でクリアできるような装備を選ぶ
					cnt = min(a[i][j + 1], cnt);
				}
				//かかる時間が最小の装備を選んでステージiをクリアしたので次の遷移に配る
				//nowは現在の状態からステージiがクリアできた時の状態に移った時の状態
				int now = (mask | (1 << i));//maskのiビット目を立てる
				dp[now] = min(dp[now], dp[mask] + cnt);
			}

		}
		//0-index
		cout << dp[(1 << n) - 1] << endl;

		a.shrink_to_fit();
	}
	return 0;
}



Measured memory_bytes: 3616
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char[] c = s.toCharArray();

    if (c[0] == c[1] || c[1] == c[2] || c[0] == c[2]) {
      System.out.println("No");
    } else {
      System.out.println("Yes");
    }

  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
using namespace std;
#define ll long long
#define mod 1000000007;


int main() {
    string s,t;
    int n;
    cin >> n >> s>> t;
    for(int i = 0;i<n;i++){
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}


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

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi std::vector<int>
#define vvi std::vector<std::vector<int> >
#define vpi std::vector<pi >
#define pi std::pair<int,int>
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (int var = (from); var <= ((int)(to)); var++)
#define DOWNTO(var, from, to) for (int var = (from); var >= ((int)(to)); var--)
#define FOR(var, to)		  UPTO(var, 0, (to)-1)
#define DOWN(var, from)	   DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) std::cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) std::cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static const int MOD = 1000000007;
static const int INF = ((1<<30)-1);
static const s64 LINF = ((1LL << 62)-1);

struct Comb {
	std::vector<std::vector<s64> > a;
	Comb(int n) { // O(n^2)
		a.resize(n+1);
		FOR(i,n+1) {
			a[i].resize(i+1, 1);
			UPTO(j,1,i-1) a[i][j] = a[i-1][j] + a[i-1][j];
		}
	}
	s64 ncr(int n, int r) {
		assert(n >= 0);
		assert(n <= (int)a.size());
		assert(r >= 0);
		assert(r <= n);
		return a[n][r];
	}
};

#define gc(c) (c)=getchar()
int ri() {
	int c,s=0,r=0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}
s64 rs64() {
	s64 r = 0;
	int c,s = 0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}

int int_less(const void *a, const void *b) {
	return (*(const int*)a - *(const int*)b);
}
int int_greater(const void *a, const void *b) {
	return (*(const int*)b - *(const int*)a);
}
std::string operator*(const std::string &s, int n){ std::string res; FOR(i,n) res += s; return res; }

template<class T> std::ostream& operator<<(std::ostream& os, std::vector<T> a) { for (auto i : a) os << i << " "; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, std::set<T> a) { for (auto i : a) os << i << " "; return os; }
template<class A, class B> std::ostream& operator<<(std::ostream&os, std::pair<A,B> a) { os << a.fi << "," << a.se; return os; }


int main() {
	int a = ri();
	std::cout << (a - 2) * 180 << std::endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<ull> A(N);
  rep(i,N) cin >> A[i];

  ull ans = 0;
  ull tmp = 0;

  for(int i=N-1; i>0; --i) {
    tmp += A[i];
    ans += (A[i-1]%MOD)*(tmp%MOD);
    ans = ans%MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4756
import java.io.*;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int i = 1;
		while (true) {
			int x =Integer.parseInt(br.readLine());
			if(x==0) break;
			sb.append("Case "+i+": "+x+"\n");
			i++;
		}
	 System.out.print(sb);
	}
	
}

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

int main() {
    ll N;
    cin >> N;
    int ans = 0;
    for (ll i = 2; i * i <= (N - 1); ++i) {
        if ((N - 1) % i == 0) {
            ++ans;
            if(i*i != N-1) ++ans;
        }
    }
    if (N > 2) ++ans;
    for (ll i = 2; i * i <= N; ++i) {
        ll tmp = N;
        if (N % i == 0) {
            while(tmp%i == 0) tmp /= i;
            tmp %= i;
            if(tmp == 1) ++ans;
        }
    }
    ++ans;
    cout << ans << endl;
}


Measured memory_bytes: 384
# absolute minima
import heapq
Q = int(input())
que = [tuple(map(int, input().split())) for _ in range(Q)]

const_term = 0
smaller = []  # 中央値以下の値を管理する((x+1)/2 以下)
smaller_sum = 0
bigger = []  # 中央値より大の値を管理する((x+1)/2 より大きい)
bigger_sum = 0
heapq.heapify(smaller)
heapq.heapify(bigger)
add_count = 0  # 何回要素として加えられたか
for x in que:
    status = x[0]
    if status == 1:
        # 更新クエリ
        add_value, add_const = x[1], x[2]
        const_term += add_const
        if add_count == 0:
            heapq.heappush(smaller, -add_value)
            smaller_sum += add_value
            add_count += 1
            continue
        elif add_count % 2 == 0:
            k_term = smaller[0]*(-1)
            k_1_term = bigger[0]
            if k_1_term >= add_value:
                heapq.heappush(smaller, add_value*(-1))
                smaller_sum += add_value
                add_count += 1
                continue
            elif k_1_term < add_value:
                x = heapq.heappop(bigger)
                bigger_sum -= x
                heapq.heappush(smaller, -x)
                smaller_sum += x
                heapq.heappush(bigger, add_value)
                bigger_sum += add_value
                add_count += 1
                continue
        else:
            if add_count == 1:
                k_term = smaller[0]*(-1)
                add_count += 1
                if k_term <= add_value:
                    heapq.heappush(bigger, add_value)
                    bigger_sum += add_value
                    continue
                elif k_term > add_value:
                    x = heapq.heappop(smaller)*(-1)
                    smaller_sum -= x
                    heapq.heappush(bigger, x)
                    bigger_sum += x
                    heapq.heappush(smaller, -add_value)
                    smaller_sum += add_value
                    continue
            else:
                add_count += 1
                k_1_term = heapq.heappop(smaller)*(-1)
                smaller_sum -= k_1_term
                M = max(k_1_term, add_value)
                m = min(k_1_term, add_value)
                heapq.heappush(bigger, M)
                bigger_sum += M
                heapq.heappush(smaller, -m)
                smaller_sum += m
                continue

    else:
        # 回答クエリ
        X = smaller[0]*(-1)
        P = (add_count+1)//2
        print(X, bigger_sum-smaller_sum+X*(2*P-add_count)+const_term)

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

int main(void){
    int n;
    cin >> n;
    double num[n];
    double ans = 0;
    for(int i = 0; i < n; i++){
        cin >> num[i];
        ans +=(1/num[i]);
       //cout << 1/num[i] << endl;
    }
   cout << fixed << setprecision(10) << 1/ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		int[] P = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        
        int min = (2 * 100000) + 1;
        int count = 0;
        
        for(int i=0;i<n;i++){
            if(min > P[i]){
                min = P[i];
                count++;
            }
        }
        
        Console.WriteLine(count);
	}
}

Measured memory_bytes: 31580
#include<iostream>
#include "algorithm"
#include "bits/stdc++.h"
using namespace std ;
#define ll long long
int h,w,k;
int n;
char a[10][10];
char c[10][10];
int ans=0;
string v;
int main(){
    scanf("%d%d%d",&h,&w,&k);
    n=h+w;
    for(int i=0;i<h;i++) {
        cin >> v;
        for(int j=0;j<v.length();j++)
            a[i][j]=v[j];
    }
    for(int i=0;i<(1<<n);i++){
        for(int x=0;x<h;x++){
            for(int y=0;y<w;y++)
                c[x][y]=a[x][y];
        }
        for(int j=0;j<n;j++){
            if(i&(1<<j)){
                //cout<<j<<" ";
                if(j<h){
                    for(int x=0;x<w;x++)
                        c[j][x]='.';
                }else{
                    for(int x=0;x<h;x++)
                        c[x][j-h]='.';
                }
            }
        }
        /*cout<<endl;
        for(int x=0;x<h;x++){
            for(int y=0;y<w;y++)
                cout<<c[x][y]<<" ";
            cout<<endl;
        }*/
        int sum=0;
        for(int x=0;x<h;x++){
            for(int y=0;y<w;y++)
                if(c[x][y]=='#')
                    sum++;
        }
        if(sum==k)
            ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define int long long
#define all(c) (c).begin(),(c).end()
#define pii pair<long long,long long>
#define endl '\n'

using namespace std;

signed main(){
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--){
        int n;
        cin >> n;
        int l,r;
        cin >> l >> r;
        int rl=l/n;
        int rr=r/n;
        if(rr>rl || l%n==0){
            cout << "OK";
        }
        else cout << "NG";
        
        
        
    }
}

Measured memory_bytes: 3608
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val b = new Array[Int](n - 1)
    for (i <- 0 until n - 1) {
      b(i) = sc.nextInt
    }

    val a = Array.fill[Int](n)(0)
    a(0) = b(0)
    for (i <- 1 until n) {
      if (i == n - 1) {
        a(i) = b(i - 1)
      } else {
        a(i) = math.min(b(i - 1), b(i))
      }
    }
    println(a.sum)
  }
}


Measured memory_bytes: 25412
#include <bits/stdc++.h>
 
using namespace std;
using LL = long long int; 
using ULL = unsigned long long;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.st <<","<<P.nd <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int main() {
  ULL a, b, c;
  cin >> a >> b >> c;
  if (c < a || c < b) {
    cout << "No";
    return 0;
  }

  ULL newR = c - a - b;
  if (c <= 0) {
    cout << "No";
    return 0;
  }

  ULL xd = 4 * a * b;
  newR *= newR;

  if (xd < newR) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=600005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
int fac[MAXN],inv[MAXN];
int upd(int x,int y) { return x+y>=mods?x+y-mods:(x+y<0?x+y+mods:x+y); }
inline int quick_pow(int x,int y)
{
	int ret=1;
	for (;y;y>>=1)
	{
		if (y&1) ret=1ll*ret*x%mods;
		x=1ll*x*x%mods;
	}
	return ret;
}
void Init(int n)
{
	fac[0]=1;
	for (int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mods;
	inv[n]=quick_pow(fac[n],mods-2);
	for (int i=n-1;i>=0;i--) inv[i]=1ll*inv[i+1]*(i+1)%mods;
}
int C(int x,int y){ return 1ll*fac[x]*inv[y]%mods*inv[x-y]%mods; }
int main()
{
	int n=read(),m=read();
	if (n>m) swap(n,m);
	Init(m);
	int ans=0;
	for (int i=0;i<=n;i++) ans=upd(ans,1ll*C(n,i)*C(m,i)%mods*fac[i]%mods*quick_pow(m+1,n-i)%mods*quick_pow(n+1,m-i)%mods*((i&1)?-1:1));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 4480
package main

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

var writer = bufio.NewWriter(os.Stdout)

func main() {
	var N int
	var A, B, C string
	fmt.Scan(&N, &A, &B, &C)

	ret := 0
	for i := 0; i < len(A); i++ {
		m := make(map[byte]int)
		m[A[i]] = 0
		m[B[i]] = 0
		m[C[i]] = 0

		ret = ret - 1
		for range m {
			ret = ret + 1
		}
	}

	fmt.Fprintf(writer, "%d\n", ret)
	writer.Flush()
}


Measured memory_bytes: 640
from collections import defaultdict
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7


def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


prime_max_factors = defaultdict(int)
for a in A:
    prime_factors = Counter(prime_factorization(a))
    for k, v in prime_factors.items():
        prime_max_factors[k] = max(prime_max_factors[k], v)


LCM = 1
for k, v in prime_max_factors.items():
    LCM *= pow(k, v, MOD)
LCM %= MOD

ans = 0
for a in A:
    ans += LCM * pow(a, MOD - 2, MOD)
    ans %= MOD

print(ans % MOD)



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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    vector<int> h(n);

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

    int num_visible = 1;

    for(int i  = 1; i < n;i++)
    {
        bool visible=true;
        for(int j = 0; j < i;j++)
        {
            if(h[j] > h[i])
            {
                visible=false;
                break;
            }
        }
        if(visible)
        {
            num_visible+=1;
        }
    }
    cout << num_visible <<endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
ans = 'YES'
while True:
  if len(s) == 0:
    break
  elif len(s) < 5:
    ans='NO'
    break
  elif s[-7:] == 'dreamer':
    s = s[:-7]
  elif s[-6:] == 'eraser':
    s = s[:-6]
  elif s[-5:] == 'dream' or s[-5:] == 'erase':
    s = s[:-5]
  else:
    ans = 'NO'
    break
print(ans)


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

char query(ll x) {
    char res;
    printf("? %lld\n", x);
    cin >> res;
    return res; 
}

int main(){
    ll l = 1, r = 10;
    for (int i = 0; i < 9; i++) {
        char d = query(r);
        if (d == 'N') {
            break;
        }
        if (r == 1e9) {
            ll t = 1;
            for (int j = 0; j < 10; j++) {
                if (query(t*2) == 'Y') {
                    printf("! %lld\n", t);
                    break;
                }
                t *= 10;
            }
            return 0;
        }
        r *= 10;
        l *= 10;
    }
    l--;
    
    ll m = r/10;
    while (r-l>1) {
        ll c = (l+r)/2;
        if (query(c*100) == 'N') l = c;
        else r = c;
    }
    if (10*m > r) printf("! %lld\n", r);
    else printf("! %lld\n", m);
    return 0;
}


Measured memory_bytes: 596
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

Int modpow(Int a, Int n, Int mod) {
    Int ret = 1;
    while (n > 0) {
        if (n & 1) {
            ret = ret * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }

    return ret;
}

vector<Int> factorials, invs;
bool is_ncr_table = false;
void calc_ncr_table(Int n, Int mod) {
    is_ncr_table = true;

    // 1! ~ n! の計算
    Int f = 1;
    factorials.push_back(f);
    for (Int i = 1; i <= n; i++) {
        f *= i;
        f %= mod;
        factorials.push_back(f);
    }

    // n!^-1 の計算
    Int inv = modpow(factorials[n], mod - 2, mod);
    // (n-1)!^-1 ~ 1!^-1 の計算
    invs.assign(n, 1);
    invs[n] = inv;
    for (Int i = n; i >= 1; i--) {
        inv *= i;
        inv %= mod;
        invs[i - 1] = inv;
    }
}

Int factorial(Int n, Int mod = 1) {
    Int ret = 1;
    if (mod == 1) {
        for (Int i = 1; i <= n; i++) {
            ret *= i;
        }

        return ret;
    } else {
        for (Int i = 1; i <= n; i++) {
            ret *= i;
            ret %= mod;
        }

        return ret;
    }
}

Int ncr(Int n, Int r, Int mod) {
    if (n < r) {
        return (Int)0;
    } else {
        if (is_ncr_table) {
            // modが素数の場合のみ
            return (factorials[n] * invs[r] % mod) * invs[n - r] % mod;
        } else {
            Int x = 1;
            for (Int i = n - r + 1; i <= n; i++) {
                x *= i;
                x %= mod;
            }
            return x * modpow(factorial(r, mod), mod - 2, mod) % mod;
        }
    }
}

int main() {
    Int n, k;
    cin >> n >> k;

    calc_ncr_table(2010, MOD);

    for (Int i = 1; i <= k; i++) {
        Int ans = ncr(n - k + 1, i, MOD);
        ans %= MOD;
        ans *= ncr(k - 1, i - 1, MOD);
        ans %= MOD;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
from collections import deque
def main():
    S = deque([s for s in input()])
    Q = int(input())
    order = True
    for i in range(Q):
        query = input().split()
        t = int(query[0])
        if t == 1:
            order = not order
        else:
            f = int(query[1])
            c = query[2]
            left = True
            if f == 1:
                if order:
                    left = True
                else:
                    left = False
            else:
                if order:
                    left = False
                else:
                    left = True
            if left:
                S.appendleft(c)
            else:
                S.append(c)
    if not order:
        S.reverse()
    print(''.join(S))

if __name__ == '__main__':
    main()


Measured memory_bytes: 8420
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func rev(a []int) {
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
}

func main() {
	defer stdout.Flush()
	n := readInt()
	a := make([]int, n)
	for i := range a {
		a[i] = readInt()
	}
	c := make([][]int, 2)
	c[0] = make([]int, 0, len(a)/2+1)
	c[1] = make([]int, 0, len(a)/2+1)
	for i, v := range a {
		c[i%2] = append(c[i%2], v)
	}
	b := make([]int, 0, len(a))
	rev(c[0])
	for i := range c {
		for _, v := range c[i] {
			b = append(b, v)
		}
	}
	if len(a)%2 == 0 {
		rev(b)
	}

	sp := ""
	for _, v := range b {
		printf("%s%d", sp, v)
		sp = " "
	}
	println()
}

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


Measured memory_bytes: 10752
#include <iostream>
#include <string>

using namespace std;

int main(){
    string taro,hanako;
    int n;
    cin>>n;
    int taroP=0,hanakoP=0;
    for (int i=0;i<n;i++){
        cin>>taro>>hanako;
        if (taro>hanako){
            taroP+=3;
        }
        else if (taro<hanako){
            hanakoP+=3;
        }
        else{
            taroP++;
            hanakoP++;
        }
    }
    cout<<taroP<<" "<<hanakoP<<endl;
    return 0;
}

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

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

    for(double i=0.0; i<=7.0;i++){
        if(N>=pow(2.0, i))
            res = pow(2.0, i);
    }
    cout << res << endl;
}

Measured memory_bytes: 3976
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int L = sc.nextInt();
    int sum = 0;
    int min = 300;
    int apple = min;
    for(int i=1;i<=N;i++){
      int d = L+i-1;
      sum+=d;
      if(Math.abs(d)<min){
        min = Math.abs(d);
        apple = d;
      }
    }
    System.out.println(sum-apple);
  }
}

Measured memory_bytes: 35684
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
int main(){
    int n,m;
    cin>>n>>m;
    if(m==0){
        if(n==1){
            cout<<0<<endl;
        }
        if(n==2){
            cout<<10<<endl;
        }
        if(n==3){
            cout<<100<<endl;
        }
        return 0;
    }
    vector<pair<int,int>> p(m);
    bool zero =false;
    rep(i,m){
        cin>>p[i].first>>p[i].second;
        if(p[i].first==1 && p[i].second==0){
            if(n!=1){
                zero=true;
            }
        }
    }
    if(zero){
        cout<<-1<<endl;
        return 0;
    }
    all(p);
    rep(i,m-1){
        if(p[i].first==p[i+1].first){
            if(p[i].second!=p[i+1].second){
                cout<<-1<<endl;
                return 0;
            }
        }

    }
    string s="1";
    //cout<<s<<endl;
    rep(i,n-1){
        s = s+'0';
    }
    rep(i,m){
        s[p[i].first-1]=(p[i].second+'0');
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	n, m := scanInt(), scanInt()
	type point struct{ x, y int }
	s := make([]point, n)
	for i := range s {
		s[i].x, s[i].y = scanInt(), scanInt()
	}
	c := make([]point, m)
	for i := range c {
		c[i].x, c[i].y = scanInt(), scanInt()
	}

	var wr = bufio.NewWriter(os.Stdout)
	for _, sv := range s {
		mn := math.MaxInt64
		var ans int
		for ci, cv := range c {
			if d := abs(sv.x-cv.x) + abs(sv.y-cv.y); d < mn {
				mn = d
				ans = ci + 1
			}
		}
		wr.WriteString(strconv.Itoa(ans) + "\n")
	}
	wr.Flush()
}


Measured memory_bytes: 640
// {{{ Template for Competitive Programming
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n; i >= 0; --i)
#define ALL(x) (x).begin(),(x).end()

const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0 ,1 ,0,-1};

using vint = vector<int>;
using pint = pair<int, int>;
// }}}

signed main() {
	int n;
	cin >> n;
	vint h(n), dp(n, INF);
	for (auto &e : h) cin >> e;
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	
	for (int i = 2; i < n; ++i) {
		dp[i] = min(dp[i], dp[i-1] + abs(h[i-1] - h[i]));
		dp[i] = min(dp[i], dp[i-2] + abs(h[i-2] - h[i]));
	}

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



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
const ll INF = ~(1<<31);
const double pi = acos(-1);

ll upper(ll num, vi &arr) {
	ll lo = 0, hi = arr.size()-1;
	ll val = 0;
	while(lo <= hi) {
		ll mid = (lo+hi)/2;
		if(arr[mid] > num) {
			val = arr.size()-mid;
			hi = mid-1;
		} else {
			lo = mid+1;
		}
	}
	return val;
}

ll lower(ll num, vi &arr) {
	ll lo = 0, hi = arr.size()-1;
	ll val = 0;
	while(lo <= hi) {
		ll mid = (lo+hi)/2;
		if(arr[mid] < num) {
			lo = mid+1;
			val = mid+1;
		} else {
			hi = mid-1;
		}
	}
	return val;
}


int main() {
    cin.sync_with_stdio(false);
	ll n;
	cin >> n;
	vi A(n), B(n), C(n);
	rep(i,0,n) cin >> A[i];
	rep(i,0,n) cin >> B[i];
	rep(i,0,n) cin >> C[i];
	ll count = 0;
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());

	rep(i,0,B.size()) {
		count += lower(B[i], A) * upper(B[i], C);
	}

	cout << count << endl;
    return 0;
}



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

int main() {
	ios_base::sync_with_stdio( false );

	int A, B;
	cin >> A >> B;

	if( A >= 13 ) {
		cout << B << endl;
	}
	else if( A >= 6 ) {
		cout << B/2 << endl;
	}
	else {
		cout << 0 << endl;
	}

	return 0;
}


Measured memory_bytes: 256