akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    string a,b;
    cin >> a >> b;
    int n = stoi(a + b);
    for (int i = 2; i * i <= n; i++) {
        if (n / i == i && n % i == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


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

int main(){
    int n,ans = 0;
    cin >> n;
    vector<int> price(n);
    vector<int> cost(n);
    vector<int> difference(n);
    for (int i = 0; i < n; i++){
        cin >> price.at(i);
    }
    for (int i = 0; i < n; i++){
        cin >> cost.at(i);
        if(price.at(i) - cost.at(i) > 0)
            ans += price.at(i) - cost.at(i);
    }
    cout << ans << endl;
}

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

int main(){
    int S;
    cin >> S;
    int h,m,s;
    
    h = S/3600;
    m = S%3600/60;
    s = S%60;
    cout << h <<":"<< m <<":" << s << endl;
    
    return 0;
}


Measured memory_bytes: 3092
//include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstring> 
#define db double 
#define LL long long
//#define int LL
#define rep(i,x,y) for (int i=x;i<=y;++i)

using namespace std;
//const int N  =  ;
//const int mod = ;
string s;
void read(int &x)
{
	int f=1;
	x=0;
	char ch=getchar();
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
	return ;
}
signed main()
{
	int w;
	cin>>s;
	read(w);
	int nw=0;
	int len=s.length();
	while (nw<len) printf("%c",s[nw]),nw+=w;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  if (a % 2 == 0 || b % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
n, y = gets.split.map(&:to_i)

ok = false
for i in 0..n do
    for j in 0..n do
        k = n - i - j
        next if k < 0
        if 10000 * i + 5000 * j + 1000 * k == y then
            puts "%d %d %d" % [i, j, k]
            ok = true
            break
        end
    end
    break if ok
end

if !ok then
    puts "-1 -1 -1"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll n, q;
    cin >> n >> q;

    char s[n];
    ll rui[n+1] = {};
    rep(i, n){
        cin >> s[i];
        if(i == 0)continue;

        rui[i+1] = rui[i];
        if(s[i] == 'C' && s[i-1] == 'A')rui[i+1]++;
    }

    rep(i, q){
        ll l, r;
        cin >> l >> r;

        cout << rui[r] - rui[l] << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int extgcd(int a, int b, int& x, int&y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else {
        x = 1;
        y = 0;
    }
    return d;
}

int inv(int a) {
    int x, y;
    extgcd(a, MOD, x, y);
    return (x + MOD) % MOD;
}

struct UniTree {
    int *par, *rank, *sz;

    UniTree(int n) {
        par = new int[n];
        rank = new int[n];
        sz = new int[n];
        for(int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }

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

    void merge(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y]) {
            par[x] = y;
            sz[y] += sz[x];
        }else {
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
            sz[x] += sz[y];
        }
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int siz(int x) {
        return sz[root(x)];
    }
};

bool check(double mid) {
    return true;
}

double bin(double left, double right) {
    while(right - left > 1e-4) {
        double mid = (left + right) / 2;
        if(check(mid)) left = mid;
        else right = mid;
    }
    return left;
}

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    ll **d = new ll*[n];
    rep(i, n) {
        d[i] = new ll[n];
        rep(j, n) d[i][j] = LINF;
        d[i][i] = 0;
    }
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        d[a - 1][b - 1] = c;
        d[b - 1][a - 1] = c;
    }

    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    rep(i, n) {
        rep(j, n) {
            if(0 < d[i][j] && d[i][j] <= l) d[i][j] = 1;
            else d[i][j] = LINF;
        }
    }
    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    int q;
    cin >> q;
    rep(i, q) {
        ll a, b;
        cin >> a >> b;
        ll ans = d[a - 1][b - 1];
        cout << (ans == LINF? -1 : ans - 1) << endl;
    }
}


Measured memory_bytes: 1280
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, -1, mod)


def main():
    d, t, s = map(int, input().split())
    print("Yes" if d - t * s <= 0 else "No")




main()


Measured memory_bytes: 64720
using AtCoderBeginnerContest118.Questions;
using AtCoderBeginnerContest118.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest118.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var ab = inputStream.ReadIntArray();
            var a = ab[0];
            var b = ab[1];
            yield return b % a == 0 ? a + b : b - a;
        }
    }
}


namespace AtCoderBeginnerContest118
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest118.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest118.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b" << endl;
  }
  else if (a > b) {
    cout << "a > b" << endl;
  }
  else {
    cout << "a == b" << endl;
  }

  return 0;
}


Measured memory_bytes: 3092
import math
a = input()
b = a
d = "".join(list(reversed(b)))
ans = 0
c = math.floor(len(a)/2)
if len(a) % 2 == 0:
    for i in range(c):
        if not b[i] == d[i]:
            ans += 1
else:
    for i in range(c):
        if not b[i] == d[i]:
            ans += 1

print(ans)

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

ll gcd(ll a, ll b){
  if(a%b == 0) return b;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b){
  return a*b/gcd(a, b);
}
int main(){
  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b) <<endl;
}
  

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

using namespace std;

int main(){
    int n;
    map<int,int>m;
    cin >> n;

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

    cout << m.size() << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD (ll) (1e9+7)
int main()
{
	string s,t;
	cin>>s>>t;
	ll maxi = 0;
	ll cnt = 0;
	for(int i=0;i<=s.size()-t.size();i++)
	{
		cnt = 0;
		for(int j=i;j<i+t.size();)
		{
			for(int k=0;k<t.size();k++)
			{
			 if(s[j] == t[k])
			  {
			    	cnt++;
			   }
			   ++j;
			}
		}
		maxi = max(maxi,cnt);
	}
	ll ans = t.size()-maxi;
	cout<<ans<<"\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
int a[110],res;
int main()
{
	cin >>n;
	for (int i=0;i<n;i++) cin >>a[i];
	sort(a,a+n);
	for (int i=0;i<n;i++)
	{
		for (int j=i+1;j<n;j++)
		{
			for (int k=j+1;k<n;k++)
			{
				if (a[i]==a[j] || a[j]==a[k] || a[i]==a[k]) continue;
				else if (a[i]+a[j]>a[k]) res++;
			}
		}
	}
	cout <<res;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#define         rep(i,n)       for (int i = 0;i<(int)(n);i++)
#define         pi             3.14159265359
#define         nl             printf("\n")
#define         gcd(a,b)       __gcd(a,b)
#define         yes            cout<<"Yes"<<"\n"
#define         no             cout<<"No"<<"\n"
#define         pf             printf
#define         sf             scanf
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+5;
typedef long long int ll;

int main()
{

    FIO;
    int i,j,k,temp,n,f=0,ans=1;
    cin>>n;
    string str;
    cin>>str;
    for(i=1;i<str.size();i++)
    {
        if(str[i]!=str[i-1])
            ans++;
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
 
typedef pair<int, int> P;
 
 
int main() {
    int AN, BN, R, x, y, d2, i, j, dx, dy, res;
    while (cin >> AN >> BN >> R, AN, BN, R) {
        P A[100001];
        P B[100001];
        vector<P> sp[250][250];
        vector<P> blo_el;
        res = 0;
 
        for (i=0; i<AN; i++) {
            cin >> A[i].first >> A[i].second;
        }
 
        for (i=0; i<BN; i++) {
            cin >> B[i].first >> B[i].second;
            sp[B[i].second/40][B[i].first/40].push_back(P(B[i].first, B[i].second));
        }
 
        for (i=0; i<AN; i++) {
            int block_x = A[i].first / 40;
            int block_y = A[i].second / 40;
            for (dx=-1; dx<=1; dx++) {
                for (dy=-1; dy<=1; dy++) {
                    if (block_x+dx<0||block_x+dx>=250||block_y+dy<0||block_y+dy>=250) continue;
                    blo_el = sp[block_y+dy][block_x+dx];
                    for (j=0; j<blo_el.size(); j++) {
                        d2 = (A[i].first - blo_el[j].first) * (A[i].first - blo_el[j].first)
                            + (A[i].second - blo_el[j].second) * (A[i].second - blo_el[j].second);
                        if (d2 <= 16*R*R) {
                            res += 1;
                        }
                    }
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int t = s.size();
  int count = 0;
  for(int i=0;i<s.size();i++){
    if(s[i] != s[t-1-i] ) count++;
  }

  cout << count / 2<< endl;
  
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> E;
const LL MOD = 1000000007LL;
LL x[100000];
LL v[100000];
LL maxA[100000];
LL maxB[100000];
int main() {
	int N;
	LL C;
	cin >> N >> C;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> v[i];
	}
	LL sum = 0;
	for (int i = 0; i < N; i++) {
		sum += v[i];
		maxA[i] = sum - x[i];
	}
	for (int i = 1; i < N; i++) maxA[i] = max(maxA[i], maxA[i - 1]);
	sum = 0;
	for (int i = N - 1; i >= 0; i--) {
		sum += v[i];
		maxB[i] = sum - (C - x[i]);
	}
	for (int i = N - 2; i >= 0; i--) maxB[i] = max(maxB[i], maxB[i + 1]);
	LL ans = 0;
	ans = max(ans, max(maxA[N - 1], maxB[0]));
	for (int i = 0; i + 1 < N; i++) {
		ans = max(ans, maxA[i] + maxB[i + 1] - x[i]);
	}
	for (int i = N - 1; i > 0; i--) {
		ans = max(ans, maxB[i] + maxA[i - 1] - (C - x[i]));
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;

int main(){
    long long n;
    cin >> n;
    long long arr[n];
    unordered_map<long long,long long> m;
    for(long long i = 0; i < n; i++){
        cin >> arr[i];
        m[arr[i] - i]++;
    }
    long long ans = 0;
    for(long long i = 0; i < n; i++){
        ans += m[-i-arr[i]];
        m[arr[i] - i]--;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 20148
import sys
fin = sys.stdin.readline


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

N, X = [int(elem) for elem in fin().split()]
x_list = [int(elem) for elem in fin().split()]

distance = [abs(x_list[i] - X) for i in range(N)]
D = distance[0]
for i in range(1, N):
    D = gcd(D, distance[i])

print(D)

Measured memory_bytes: 14168
#include <iostream>
using namespace std;
int main(void){
 
 
 
    int a,b,c,tmp;

    cin >>a>>b>>c;

    if(a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    
    if(b>c){
        tmp=b;
        b=c;
        c=tmp;
    }
    
      if(a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    
      cout<<a<<" "<<b<<" "<<c<<endl;
    
    return 0;
 
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
//using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
using pii=pair<ll,ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__);
 
int main(){
    dcl(n);
    int ans=INT_MAX;
    range(i,1,ceil(sqrt(n))+3){
        if(n%i==0){
            ans=min(ans,(int)(to_string(max((ll)i,n/i)).length()));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>
 
const int MAX_N = 100050;
const long long MOD = (long long)1000000007;
int N;
int a[MAX_N];
int loc[MAX_N];

/*
long long pow_mod(long long base, long long exp_num, long long mod_num) {
    long long ret = 1;
    long long tmp = base;
    long long bit = 0;
    while ((1 << bit) <= exp_num) {
        if (((exp_num >> bit) & 1) == 1) {
            ret = (ret * tmp) % mod_num;
        }
        tmp = (tmp * tmp) % mod_num;
        bit++;
    }
    return ret;
}
*/

long long pow_mod(long long x, long long n, long long mod_num) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) { res = (res * x) % mod_num; }
        x = (x * x) % mod_num;
        n = (n >> 1);
    }
    return res;
}
 
int main(int argc, char **argv) {
    //std::cout << pow_mod(2, 3, 100) << std::endl;
    //std::cout << pow_mod(2, 3, 5) << std::endl;
    //std::cout << pow_mod(2, 6, 100) << std::endl;
    
    //std::cout << pow_mod(20, MOD - 2, MOD);

    std::cin >> N;

    for (int i = 1; i <= N + 1; i++) {
        std::cin >> a[i];
    }

    for (int i = 1; i <= N; i++) {
        loc[i] = -1;
    }

    int X = -1;
    for (int i = 1; i <= N + 1; i++) {
        if (loc[a[i]] == -1) {
            loc[a[i]] = i;
        } else {
            X = N + 1 - (i - loc[a[i]] + 1);
        }
    }

    long long total = N + 1;
    long long pair_num = 1;
    std::cout << total - pair_num << std::endl;

    for (int k = 2; k <= N + 1; k++) {
        //total = total * (N + 1 - k + 1) / k;
        //pair_num = pair_num * (X - (k - 1) + 1) / (k - 1);
        total = total * ((pow_mod(k, MOD - 2, MOD) * (N + 1 - k + 1)) % MOD);
        pair_num = pair_num * ((pow_mod(k - 1, MOD - 2, MOD) * (X - (k - 1) + 1)) % MOD);
        //std::cout << 
        //std::cout << total << " " << total % MOD << std::endl;
        total = total % MOD;
        pair_num = pair_num % MOD;
        std::cout << (total - pair_num + MOD) % MOD << std::endl;
    }

    return 0;
}

Measured memory_bytes: 2048
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

int modosu(int a, int size){
	if(a>size-1){
		return a - size;
	}
	else return a;
}

int main (){
	string a,b;
	cin >> a >> b;
	int count =0;
	int size = a.length();
	bool flag=true;
	string ans = "No";
	rep(i,size){
		flag = true;
		rep(j,size){
			if(a[j]!=b[modosu(j+count,size)]){
				flag = false;
				break;
			}
		}
		if(flag){
			ans = "Yes";
			break;
		}
		count ++;
	}
	cout << ans << endl;


	return 0;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;

void solve(){
  int y = 1^2^3^4^5;
  int x, c = 0;
  for(int i=0;i<5;i++){
    cin>>x;
    c^=x;
  }
  cout << (y^c) << endl;
  return;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}


Measured memory_bytes: 3648
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    static class FastReader
        {
            BufferedReader br;
            StringTokenizer st;

            public FastReader()
            {
                br = new BufferedReader(new
                        InputStreamReader(System.in));
            }

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

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

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

            double nextDouble()
            {
                return Double.parseDouble(next());
            }

            String nextLine()
            {
                String str = "";
                try
                {
                    str = br.readLine();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
                return str;
            }
        }
    public static void main(String[] args) {
        FastReader ob = new FastReader();
        int n =ob.nextInt();
        HashMap<String,Integer> map=new HashMap<>();
        int count=0;
        for (int i = 0; i < n; i++) {
            String s1=ob.next();
            if(!map.containsKey(s1)){
                map.put(s1,0);
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 72028
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


void solve(string s,int dice[6]){
    int ans[6]={};
    rep(i,6)ans[i]=dice[i];
    if(s=="North"){
        ans[0]=dice[1];
        ans[1]=dice[5];
        ans[4]=dice[0];
        ans[5]=dice[4];
    }
    if(s=="East"){
        ans[0]=dice[3];
        ans[2]=dice[0];
        ans[3]=dice[5];
        ans[5]=dice[2];
    }
    if(s=="West"){
        ans[0]=dice[2];
        ans[2]=dice[5];
        ans[3]=dice[0];
        ans[5]=dice[3];
    }
    if(s=="South"){
        ans[0]=dice[4];
        ans[1]=dice[0];
        ans[4]=dice[5];
        ans[5]=dice[1];
    }
    if(s=="Right"){
        ans[1]=dice[2];
        ans[2]=dice[4];
        ans[3]=dice[1];
        ans[4]=dice[3];
    }
    if(s=="Left"){
        ans[1]=dice[3];
        ans[2]=dice[1];
        ans[3]=dice[4];
        ans[4]=dice[2];
    }
    
    rep(i,6){
        dice[i]=ans[i];
    }
}

int main() {
    int n;
    
    while(cin>>n){
        if(n==0)break;
        
        vi mem;
        rep(i,n){
            mem.pb(0);
        }
        int fie=0;
        
        string s;
        cin>>s;
        rep(i,s.size()){
            if(s[i]=='M'){
                mem[i%n]++;
            }
            if(s[i]=='S'){
                fie+=mem[i%n]+1;
                mem[i%n]=0;
            }
            if(s[i]=='L'){
                mem[i%n]+=fie+1;
                fie=0;
            }
        }
        sort(all(mem));
        rep(i,n){
            cout<<mem[i]<<" ";
        }
        cout<<fie<<endl;
    }
    return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#include <string>
using namespace std;
typedef long long llong;

// 完全二分木の子の数(葉以外)
#define BINARY_CHILDREN_NUM 2

// 空きノードを示す定数
#define NIL 2100000000
// 要素の最大数
#define MAX 600000


// 完全二分木ヒープの定義
struct BinaryHeap {
    int key, left, right, parent;
    };

struct BinaryHeap Heap[MAX];

// ヒープサイズ
int H;

// 最大ヒープ
void maxHeapify(BinaryHeap A[], int i)
{
    int largest = 0;
    int l = 2 * i;
    int r = 2 * i + 1;
    // 左の子、自分、右の子で値が最大のノードを選ぶ
    if (l <= H && A[l].key > A[i].key) {
        largest = l;
    } else {
        largest = i;
    }

    if (r <= H && A[r].key > A[largest].key){
         largest = r;
    }

    if (largest != i) {
         swap(A[i],A[largest]);
         //cout << A[i].key << endl;
         // 再帰的に呼び出し
         maxHeapify(A, largest);
    }
}

void BuildMaxHeap(BinaryHeap A[])
{
    for(int i=H/2; i>0; i--) {
        maxHeapify(A,i);
    }
}

int main()
{
    // 節点の個数
    int n = 0;
    // 次数
    int iDeg = 0;
    int iNodeIdx = 0;
    int left, node, root;

    cin >> H;

    // 初期化
    for (int i = 0; i < MAX; i++)
    {
        Heap[i].parent = Heap[i].left = Heap[i].right = NIL;
    }
    
    // 各ノードに対して、
    // その節点番号、子の情報を、
    // 記憶していく
    for (int i = 1; i < H+1; i++)
    {
        //キーを取得
        cin >> iNodeIdx;
        Heap[i].key = iNodeIdx;
        //cout << Heap[i].key << endl;
        int tmp = 0;

        // 親・子を取得
        double ParentIdx = floor(i/2);
        if(ParentIdx > 0 && ParentIdx < n+1) Heap[i].parent = ParentIdx;

        tmp = 2 * i;
        if (tmp > 0 && tmp < n+1) Heap[i].left = tmp;
        
        tmp = 2 * i + 1;
        if (tmp > 0 && tmp < n+1) Heap[i].right = tmp;
    }

    BuildMaxHeap(Heap);

    for (int i = 1; i < H+1; i++)
    {
        if (i == H) {
            cout << " " << Heap[i].key << "\n";
        } else {
            cout << " " << Heap[i].key;
        }
    }

    return 0;
}


Measured memory_bytes: 12500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG

int main(){
    ll n; cin>>n;
    vector<ll> num (100010,0);
    ll ans=0;

    rep(i,n){
        ll a;
        cin>>a;
        num[a]++;
        ans+=a;
    }

    ll q; cin>>q;
    rep(i,q){
        ll b,c;
        cin>>b>>c;
        ll v=num[b];
        num[b]=0;
        num[c]+=v;
        ans-=v*b;
        ans+=v*c;
        cout<<ans<<endl;
    }
}

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

int main() {
    int N;
    cin >> N;
    int x[N], y[N], h[N];
    for (int i = 0; i < N; ++i) cin >> x[i] >> y[i] >> h[i];

    int Cx, Cy, H;
    for (int i = 0; i <= 100; ++i) {
        for (int j = 0; j <= 100; ++j) {
            bool solve = true;
            int res = -1, sum;
            for (int t = 0; t < N; ++t) {
                if (h[t]) {
                    sum = h[t] + abs(x[t] - i) + abs(y[t] - j);
                    if (res == -1) res = sum;
                    else {
                        if (res != sum) {
                            solve = false;
                            break;
                        }
                    }
                }
            }
            for (int t = 0; t < N; ++t) {
                if (h[t] == 0) {
                    if (sum - abs(x[t] - i) - abs(y[t] - j) > 0) {
                        solve = false;
                        break;
                    }
                }
            }
            if (solve) {
                Cx = i;
                Cy = j;
                H = sum;
            }
        }
    }

    cout << Cx << ' ' << Cy << ' ' << H << endl;
    
    return 0;
}

Measured memory_bytes: 256
n, x = map(int, input().split())

def chooseMoney(n, x):
    for i in range(n + 1):
        remain = x - 10000 * i
        for j in range(min(remain // 5000, n - i) + 1):
            if remain - j * 5000 == (n - i - j) * 1000:
                return "{} {} {}".format(i, j, n - i - j)
    return "-1 -1 -1"

print(chooseMoney(n, x))

Measured memory_bytes: 3060
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");
//    	Scanner sc = new Scanner(file);

    	Scanner sc = new Scanner(System.in);

    	String S = sc.next();
    	String T = sc.next();

    	System.out.println(T+S);

    }

}


Measured memory_bytes: 21460
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N, K;
    cin >> N >> K;

    if (N % K == 0) cout << 0 << endl;
    else cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np
from scipy.sparse import csr_matrix, csgraph
import sys

input = sys.stdin.readline

U = 10 ** 5
n = int(input())
xy = np.array([input().split() for _ in range(n)], dtype=np.int32)

graph = csr_matrix((np.ones(n, dtype=np.bool), (xy[:, 0], U + xy[:, 1])), (2 * U + 1, 2 * U + 1))
_, component = csgraph.connected_components(graph)

x_cnt = np.bincount(component[:U + 1], minlength=2 * U + 2)
y_cnt = np.bincount(component[U + 1:], minlength=2 * U + 2)
pts_cnt = np.bincount(component[xy[:, 0]], minlength=2 * U + 2)
answer = (x_cnt * y_cnt - pts_cnt).sum()
print(answer)


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

int main(void) {
	int person, days, choco, a[100];
	int i;
	cin >> person >> days >> choco;
	for (i = 0; i < person; i++) {
		cin >> a[i];
		choco++;
		choco +=  (days - 1) / a[i];
	}

	cout << choco << endl;

	return 0;
}

Measured memory_bytes: 256
let split str delim =
  let rec doit s acc =
    match
      try Some (String.rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s1 (s2 :: acc)
  in
  doit str []

let () =
  let open Queue in
  let (que : (string * int) Queue.t) = create () in
  match List.map int_of_string (split (read_line ()) ' ') with
  | [n; q] -> begin
      let rec read i =
        if i < n then begin
          match split (read_line ()) ' ' with
          | [s; t] -> (add (s, int_of_string t) que; read (i + 1))
          | _ -> exit 1
        end
      in
      read 0;
      let rec doit cnt =
        if not (is_empty que) then begin
          let s, t = take que in
          let rest = t - q in
          if rest <= 0 then (let x = cnt + t in print_string s; print_char ' '; print_int x; print_char '\n'; doit x)
          else (add (s, rest) que; doit (cnt + q))
        end
      in
      doit 0
    end
  | _ -> exit 1

Measured memory_bytes: 10684
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var input = ReadLine().Split(' ');
        var x = ToInt32(input[0]);
        var y = ToInt32(input[1]);
        WriteLine(x + y / 2);
    }
}

Measured memory_bytes: 13268
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int K,S;
  cin >> K >> S;

  int ans{};
  for(auto x = 0; x <= K; ++x) {
    int X = S - x;
    if (X > 2*K) continue;
    if (X < 0) break;
    ans += min(X,2*K-X) + 1;
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll k;
    cin >> k;
    string s;
    cin >> s;
    if (len(s) <= k) cout << s << endl;
    else {
        string ss = s.substr(0, k);
        ss += "...";
        cout << ss << endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <functional>

using namespace std;

int N, M;
vector<int> X;
vector<int> x;

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

    for (int i = 0; i < M; i++) {
        int tmp; cin >> tmp;
        X.push_back(tmp);
    }

    if (N > M) {
        cout << 0 << endl;
    }
    else{
        sort(X.begin(), X.end(), greater<int>());

        for (int i = 0; i < M - 1; i++) {
            x.push_back(X[i] - X[i + 1]);
        }

        sort(x.begin(), x.end(), greater<int>());
        x.erase(x.begin(), x.begin() + N - 1);

        cout << accumulate(x.begin(), x.end(), 0) << endl;

    }

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <math.h>

using namespace std;


int main() {
	long N, L;
	cin >> N >> L;
	long *a = new long[N];

	cin >> a[0];

	long maxL = 0, maxI = 0;
	long l = a[0];

	for (int i = 1; i < N; i++) {
		cin >> a[i];
		l += a[i];
		if (i > 1) {
			l -= a[i - 2];
		}
		if (l > maxL) {
			maxL = l;
			maxI = i;
		}
	}

	if (maxL >= L) {
		cout << "Possible" << endl;
		for (int i = N - 1; i > maxI; i--) {
			cout << i << endl;
		}
		for (int i = 1; i <= maxI; i++) {
			cout << i << endl;
		}
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>

int main(void){

int a[100];
int w,n,i,j,b,c,d,e;

scanf("%d",&w);

for(int i=0; i<w;i++){
a[i]=i+1;
}

scanf("%d",&n);

for(int j = 0; j<n; j++){
  scanf("%d,%d",&b,&c);
  if(a[c-1] == c && a[b-1] == b){
  a[c-1] = b;
  a[b-1] = c;
  }
  else if(a[c-1] != c && a[b-1] == b){
  a[b-1] = a[c-1];
  a[c-1] = b;
  }
  else if(a[c-1] == c && a[b-1] != b){
  a[c-1] = a[b-1];
  a[b-1] = c;
  }
  else if(a[c-1] != c && a[b-1] != b){
  d=a[b-1];
  e=a[c-1];
  a[b-1]=e;
  a[c-1]=d;
  }
}  

for(int i = 0; i<w; i++){
  printf("%d\n",a[i]);
}
return 0;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

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

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  vector<string> a;
  cin >> N;
  a.resize(N);
  rep(i, N) cin >> a[i];

  bool flag = false;
  rep(i, N) rep(j, N) if(a[i][j] == '#') flag = true;
  if(!flag) {
    cout << -1 << endl;
    return 0;
  }

  int blackcol = 0;
  rep(j, N) {
    bool wf = false;
    rep(i, N) if(a[i][j] == '.') wf = true;
    if(!wf) blackcol++;
  }

  int ans = inf;
  rep(i, N) {
    int cnt = 0;
    bool bf = false;
    rep(j, N) if(a[j][i] == '#') bf = true;
    if(!bf) cnt++;
    rep(j, N) if(a[i][j] == '.') cnt++;
    chmin(ans, cnt+N-blackcol);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

int main() {
    string S;
    cin >> S;
    vector<bool> bit(S.size());
    for (int i = 0; i < S.size(); i++) {
        if (S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T') {
            bit.at(i) = true;
            continue;
        }
        bit.at(i) = false;
    }
    int ans = 0;
    int sum = 0;
    for (int i = 0; i < S.size(); i++) {
        if (bit.at(i)) {
            sum++;
            continue;
        }
        ans = max(ans, sum);
        sum = 0;
    }
    ans = max(ans, sum);
    cout << ans << endl;
}

Measured memory_bytes: 256
count = 0
p, s = 0, 0
n, k = map(int, input().split())
for i in range(n):
    p = i + 1
    count = 0
    while(p < k):
        p = p * 2
        count += 1
    s += ((1 / n ) * ((1 / 2) **  count))
print(s)

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

bool is_reverse(string s) {
    string rev_s = s;
    reverse(s.begin(), s.end());
    return rev_s == s;
}

int main() {
    string s; cin >> s;
    bool first = is_reverse(s.substr((s.length() + 3)/2 - 1));
    bool second = is_reverse(s.substr(0, (s.length()-1) / 2));
    bool reverse = is_reverse(s);
    string mes;
    if (first && second && reverse) mes = "Yes";
    else mes = "No";
    cout << mes << endl;
}

Measured memory_bytes: 256
#define ALGORITHM   0
#define CLIMITS     0
#define CMATH       0
#define DEQUE       0
#define LIST        0
#define MAP         0
#define QUEUE       0
#define SET         0

#define DP          1
#define DIRECTIONS  0

#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#if ALGORITHM
#include <algorithm>
#endif
#if CLIMITS
#include <climits>
#endif
#if CMATH
#include <cmath>
#endif
#if DEQUE
#include <deque>
#endif
#if LIST
#include <list>
#endif
#if MAP
#include <map>
#endif
#if QUEUE
#include <queue>
#endif
#if SET
#include <set>
#endif

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;

#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.1415926535897932384626433832795028841971L;
constexpr ll INF9 = 1000000001;
constexpr ll INF18 = (long long)1e18 + 1;
constexpr ll MOD = 1000000007;

#if DP
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 (a>b) { a = b; return 1; } return 0; }
#endif

#if DIRECTIONS
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#endif
//
//
//
//
//
/*追加部分*/



/*main関数*/

int main() {
FASTIO;
    string s, t;
    cin >> s >> t;

    int ss = s.length();
    int ts = t.length();

    char _S[1010], _T[1010];
    for(int i = 0; i < ss; i++) _S[i] = s[i];
    for(int j = 0; j < ts; j++) _T[j] = t[j];

    int cnt = 0;
    int ans = INF9;

    for(int k = 0; k < ss - ts + 1; k++){
        for(int l = 0; l < ts; l++){
            if(_S[l+k] != _T[l]) cnt++;
        }
        chmin(ans, cnt);
        cnt = 0;
    }

    cout << ans << endl;
return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    int ans = 0;
    for (int i = 0; i < n/2; ++i) {
        if (s[i] != s[n-i-1]) ++ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
s = gets.split("")
res = [] #countを記録

for k in 1..n-1 do #分け方
  pre = s[0,k]
  aft = s[k, n-k]
  already = [] #出て来た文字を格納
  count = 0
  if k <= (n-1)/2 #一つ目から
    for i in 0..k-1 do
      mozi = pre[i]
      if !already.include?(mozi) and aft.include?(mozi)
        count += 1
        already << mozi
      end
    end
  else
    for i in 0..n-k+1 do
      mozi = aft[i]
      if !already.include?(mozi) and pre.include?(mozi)
        count += 1
        already << mozi
      end
    end
  end
  res << count
end


puts res.max


Measured memory_bytes: 1788
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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 S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;

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

  std::cout << 180*(N-2) << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n[4];
	int sum;
	int x, y;
	
	scanf("%d", &n[0]);
	scanf("%d", &n[1]);
	scanf("%d", &n[2]);
	scanf("%d", &n[3]);
	
	sum = n[0] + n[1] + n[2] + n[3];
	
	x = sum / 60;
	y = sum % 60;
	
	printf("%d\n", x);
	printf("%d\n", y);
	
	return (0);
}

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

int main() {
  char c;
  cin >> c;
  if (c == 'A' || c == 'T') {
    cout << (char)(('A' ^ 'T') ^ c) << endl;
  } else {
    cout << (char)(('C' ^ 'G') ^ c) << endl;
  }
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    map<string, bool> m;
    int count = 0;
    for(int i = 0; i < n; i++){
        int p[3];
        cin >> p[0] >> p[1] >> p[2];
        sort(p, p+3);
        string s = to_string(p[0]) + to_string(p[1]) + to_string(p[2]);
        auto itr = m.find(s);
        if(itr != m.end()){
            count++;
        }else{
            m[s] = true;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main()
{
	int N, M, C;
	cin >> N;
	cin >> M;
	cin >> C;
	vector<int> B(M);
	for (int i = 0; i < M; i++)
	{
		cin >> B[i];
	}
	vector<vector<int>> A;
	for (int i = 0; i < N; i++)
	{
		vector<int> Aline(M);
		for (int j = 0; j < M; j++)
		{
			cin >> Aline[j];
		}
		A.push_back(Aline);
	}
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		int sum = 0;
		for (int j = 0; j < M; j++)
		{
			sum += A[i][j] * B[j];
		}
		if (sum+C > 0)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
    int N, n;
    cin >>N; n = N/2;
    vector<int> A(n), B(n);
    for (int i = 0; i < N; i++) {
        if (i%2 == 0) cin >> A[i/2];
        else cin >> B[i/2];
    }
    
    set<int> sa, sb;
    map<int, int> ma, mb;
    for (auto a : A) { sa.insert(a); ma[a] = 0; }
    for (auto b : B) { sb.insert(b); mb[b] = 0; }
    for (auto a : A) ma[a]++;
    for (auto b : B) mb[b]++;
    
    vector<pair<int, int>> cnta, cntb;
    for (auto a : sa) cnta.emplace_back(ma[a], a);
    for (auto b : sb) cntb.emplace_back(mb[b], b);
    sort(cnta.rbegin(), cnta.rend()); sort(cntb.rbegin(), cntb.rend());
    int sza = cnta.size(), szb = cntb.size();
    if (sza == 1 || szb == 1) {
        if (sza == 1 && szb == 1) {
            cout << ((A[0] == B[0]) ? n : 0) << endl;
            return 0;
        }
        if (sza == 1 && szb > 1) {
            if (cntb[0].second == cnta[0].second) {
                cout << n-cntb[1].first << endl;
            } else {
                cout << n-cntb[0].first << endl;
            }
            return 0;
        } else {
            if (cnta[0].second == cntb[0].second) {
                cout << n-cnta[1].first << endl;
            } else {
                cout << n-cnta[0].first << endl;
            }
            return 0;
        }
    }
    
    pair<int, int> am = cnta[0], as = cnta[1], bm = cntb[0], bs = cntb[1];
    if (am.second != bm.second) {
        cout << N-am.first-bm.first << endl;
        return 0;
    }
    int ans = min(N-am.first-bs.first, N-as.first-bm.first);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11132
#include <bits/stdc++.h>
    #include<math.h>
    #define rep(i,n) for (int i = 0; i < (n) ; ++i)
    using namespace std;
    using ll = long long ;
    using P = pair<int , int> ;
    #define PI 3.14159265358979323846264338327950
    #define INF 1e18 
     
    int main(){
        int n, m ,k ;
        cin >> n >> m >> k ;
        vector<int> a (n) ;
        vector<ll> b (m) ;
        rep(i, n) cin >> a[i] ;
        rep(i, m) cin >> b[i] ;
        ll sum = 0 ;
        rep(i, n){
            sum += a[i] ;
        }
        rep(i, m - 1) {
            b[i+1] += b[i] ;
        }


        int ans = 0 ;
        int f = n ;
        ll o = k - sum ;
        if(o >= 0) {
            int pp = lower_bound(b.begin(), b.end(), o) - b.begin() ;
            if(b[pp] == o){
                 pp++ ;
            }
            ans= max(ans, pp + f) ;
        }
        for(int i = n - 1 ; i >= 0 ; i--){
            f-- ;
            sum -= a[i] ;
            ll t = k - sum ; 
            if(t <= 0){
                continue ;
            }
            else {
                int p = lower_bound(b.begin(), b.end(),t) - b.begin() ;
                if(b[p] == t){
                    p++ ;
                }
                ans= max(ans, p + f) ;
            }
        }
        cout << ans << endl ;
        return 0 ;
    }

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

int main(){
  int N;
  string S,T;
  cin >> N >> S;
  T=S;
  sort(S.begin(),S.end());
  int count=0;
  for(int i=0;i<N;i++){
    if(S.at(i)!=T.at(i)){
      count++;
    }
  }
  cout << count/2 << endl;
}

Measured memory_bytes: 3876
#include <iostream>

using namespace std;

int f(int n){
  if(n%2 == 0)
    return n/2;
  else
    return 3*n+1;
}

int main(void){
  int *a;
  a = new int;

  cin >> a[0];

  int i = 1, j;
  while(1){
    a[i] = f(a[i-1]);
    for(j=0; j<i; j++)
      if(a[j] == a[i])
	goto loopend;
    i++;
    }
 loopend:
  // for(j=0; j<i+1; j++)
  //  cout << a[j] << " ";
  //cout << endl;
  cout << i+1 << endl;

  return 0;
}


Measured memory_bytes: 256