akhauriyash/Code-Regression huggingface dataset:
// atcoder/nikkei2019-2-qual/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int n, m;
  while (cin >> n >> m) {
    const int N = 2 * 1e5 + 5;
    vec<pair<int, int>> g[N];
    for (int i = 0; i < m; ++i) {
      int a, b, c;
      cin >> a >> b >> c;
      --a;
      --b;
      g[a].push_back(make_pair(b, c));
    }
    for (int i = 1; i < n; ++i) {
      g[i].push_back(make_pair(i - 1, 0));
    }

    priority_queue<pair<lli, int>> q;
    q.push(make_pair(0, 0));
    const lli inf = 1LL << 60;
    lli cost[N];
    fill(cost, cost + N, inf);
    cost[0] = 0;
    while (q.size()) {
      auto p = q.top();
      q.pop();
      if (cost[p.second] != -p.first) continue;
      each (e, g[p.second]) {
        if (cost[e.first] > cost[p.second] + e.second) {
          cost[e.first] = cost[p.second] + e.second;
          q.push(make_pair(-cost[e.first], e.first));
        }
      }
    }

    cout << (cost[n - 1] == inf ? -1 : cost[n - 1]) << endl;
  }

  return 0;
}


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

int sumofdigits(int x)
{
    int sum = 0;
    while (x > 0)
    {
        sum += x % 10;
        x /= 10;
    }

    return sum;
}

int main()
{
    int N, A, B;
    cin >> N >> A >> B;

    int sum = 0;

    for (int i = 1; i <= N; i++)
    {
        int num = sumofdigits(i);
        if (num >= A && num <= B)
            sum += i;
    }

    cout << sum << endl;
}

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

int main () {
  string s,t;
  cin >>s>>t;
  
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if (s<t){
    cout<<"Yes"<<endl;
  }else {
    cout <<"No"<<endl;
  }
}


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

int N, K;
int64_t monstersHP = 0;


int main() {
	cin >> N >> K;
	vector<int64_t> Monsters(N);
	for (int i = 0; i < N; i++) {
		cin >> Monsters.at(i);
	}
	auto comp = [](int64_t a, int64_t b) {return a > b; };
	sort(Monsters.begin(), Monsters.end(), comp);
	if (K > N)K = N;
	for (int i = 0; i < K; i++) {
		Monsters.at(i) = 0;
	}
	for (int i = 0; i < N; i++) {
		monstersHP += Monsters.at(i);
	}
	cout << monstersHP << endl;

}

Measured memory_bytes: 1792
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

long disit_sum(long a)
{
    long sum,disit_num;
    foreach(disit;0 .. 9)
    {
        disit_num = a / pow(10, disit);
        sum += disit_num % 10;
    }
    return sum;
}


void main()
{
    long a,b,t;
    scan(a,b,t);
    long sum,i = 1,now = a;
    while(now <= t)
    {
        sum += b;
        i++;
        now = i * a;
    }
    writeln(sum);
}

Measured memory_bytes: 256
n = int(input())
F = [list(map(int, input().split())) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]

# print(F)
# print(P)
max_score = -float('inf')

for pattern_i in range(1, 2**10):
  op_num = [0]*n
  for pos_i in range(10):
    if pattern_i & 1<<pos_i:
      for n_i in range(n):
        op_num[n_i] += F[n_i][pos_i]
        
  max_score = max(max_score, sum([p_i[op_num_i] for p_i, op_num_i in zip(P, op_num)]))

print(max_score)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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 T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
Vi accum(Vi v){Vi ret((v).size());ret[0]=v[0];REP(i,1,(v).size()) ret[i]=ret[i-1]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
    int n;
    cin>>n;
    Vi c(n);
    REP(i,0,n) cin>>c[i];

    Vi dp(n);
    dp[0]=1;
    map<int,int> ma;
    REP(i,0,n) ma[c[i]]=-1;
    ma[c[0]]=0;

    REP(i,1,n){
        if(c[i]==c[i-1]){
            dp[i]=dp[i-1];
            ma[c[i]]=i;
        }else if(ma[c[i]]==-1){
            dp[i]=dp[i-1];
            ma[c[i]]=i;
        }else{
            int j=ma[c[i]];
            dp[i]=(dp[i-1]+dp[j])%MOD;
            ma[c[i]]=i;
        }
    }
    cout<<dp[n-1]<<endl;
//    vout(dp);
    return 0;
}


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

using namespace std;
const int mx = 3e3+5;
char w[2][mx];
int n[2];
int dp[mx][mx];
vector <char> vec;
int main(){
   scanf("%s %s",w[0],w[1]);
   n[0] = strlen(w[0]);
   n[1] = strlen(w[1]);
  // printf("\n%c %c\n",w[0][2], w[1][3]);
   for(int i=1; i<=n[0]; i++){
      for(int j=1; j<=n[1]; j++){
         if(w[0][i-1] == w[1][j-1]) dp[i][j] =  dp[i-1][j-1]+1;
         else{
            dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
         }
      }
   }
   int i = n[0], j = n[1];

   while(i>0 && j>0){
      //printf("%d %d %d\n",i, j, dp[i][j]);
      if(w[0][i-1] == w[1][j-1]){
         vec.push_back(w[0][i-1]);
         i--;
         j--;
      }
      else{
         if(i > 0 && dp[i-1][j] >= dp[i][j-1]) i--;
         else j--;
      }
   }
   for(int l = vec.size()-1; l>=0; l--){
      printf("%c",vec[l]);
   }
}


Measured memory_bytes: 35456
/// @file
/// @copyright Copyright 2018 thousand
/// @version Accepted.
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;

int N, C[501], S[501], F[501], t;

int main() {
    cin >> N;

    for (int i = 1; i <= N - 1; ++i) {
        cin >> C[i] >> S[i] >> F[i];
    }

    for (int i = 1; i <= N - 1; ++i) {
        t = 0;

        for (int j = i; j <= N - 1; ++j) {
            if (j == i) {
                t = S[j];
            } else if (t < S[j]) {
                t = S[j];
            } else {
                int St = t - S[j];
                int Ft = St % F[j];

                if (Ft != 0) {
                    t += F[j] - Ft;
                }

            }

            t += C[j];
        }

        cout << t << endl;
    }

    cout << 0 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	static Scanner sc;
	static int a,n,m,HPQ[][],nowX,nowY;
	public static void main(String[]args){
		sc=new Scanner(System.in);
		while(true){
			n=sc.nextInt();
			m=sc.nextInt();
			a=sc.nextInt();
			if(n==0 && m==0 && a==0){break;}
			HPQ=new int[m+1][3];
			for(int i=0;i<m;i++){
				HPQ[i][0]=sc.nextInt();
				HPQ[i][1]=sc.nextInt();
				HPQ[i][2]=sc.nextInt();
			}
			nowX=a;
			nowY=0;
			for(int i=0;i<m;i++){
				if(nowY<HPQ[i][0]){
					nowY=HPQ[i][0];
				}
			}
			while(nowY>0){
				for(int i=m;i>=0;i--){
					if(nowY==HPQ[i][0] && nowX==HPQ[i][1]){
						nowX=HPQ[i][2];
					}else if(nowY==HPQ[i][0] && nowX==HPQ[i][2]){
						nowX=HPQ[i][1];
					}
				}
				nowY--;
			}
			System.out.println(nowX);
		}
	}
}

Measured memory_bytes: 62644
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T> void dbg(T x) { cout << x << "\n"; }
template<typename T, typename U> static void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void chmax(T &x, U y) { if (x < y) x = y; }

int n, z, w;
int a[2020];

int main() {
    cin >> n >> z >> w;
    rep(i, n) cin >> a[i];
    if (n == 1) {
        cout << abs(a[0] - w) << endl;
        return 0;
    }
    cout << max(abs(a[n - 1] - a[n - 2]), abs(a[n - 1] - w)) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        long x = sc.nextLong();
        long y = sc.nextLong();
 
        int ans = 0;
        while(x <= y) {
            ans++;
            x *= 2;
        }
        System.out.println(ans);
 
        sc.close();
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,a[N];
struct each{
	int a,b;
}b[N];
bool com(each x,each y){
	return x.a<y.a;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&b[i].a);
		b[i].b=i,a[b[i].a]=i;
	}
	int now=1;
	sort(b+1,b+n+1,com);
	for(int i=1;i<=n;i++){
		for(int j=1;j<b[i].b;j++){
			while(now<=n*n&&a[now])	++now;
			if(now>b[i].a){
				puts("No");
				return 0;
			}
			a[now++]=b[i].b;
		}
	}

	now=n*n;
	for(int i=n;i;i--){
		for(int j=1;j<=n-b[i].b;j++){
			while(now<=n*n&&a[now])	--now;
			if(now<b[i].a){
				puts("No");
				return 0;
			}
			a[now--]=b[i].b;
		}
	}

	puts("Yes");
	for(int i=1;i<=n*n;i++)	printf("%d ",a[i]);
	return 0;
}

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

int main(){
 UL N; scanf("%u",&N);
 UL A[100000]; rep(i,N) scanf("%u",&A[i]);
 vector<pair<UL,int>> Q;
 Q.push_back({0,2});
 Q.push_back({A[0],-1});
 Q.push_back({A[N-1],-1});
 rep(i,N-1){
  UL a=A[i], b=A[i+1];
  if(a>b) swap(a,b);
  Q.push_back({a,1});
  Q.push_back({b,-1});
 }
 sort(Q.begin(),Q.end());
 int ans=0;
 int sim=0;
 for(auto q:Q){
  sim += q.second;
  ans = max(ans,sim);
 }
 printf("%d\n",ans/2);
 return 0;
}



Measured memory_bytes: 5308
n = int(input())

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


d = divisor(n)

mn = 20
for i in d:
    if (n / i) % 1 == 0:
        mx = max(len(str(n // i)), len(str(i)))
        mn = min(mn, mx)

print(mn)


Measured memory_bytes: 39536
/**
 *       Author:  kulubat
 *       Written on Thursday, 16 April 2020.
 **/

#include <bits/stdc++.h>


using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string w;

    cin >> w;


    unordered_map<char,int> A;

    for(auto c: w)
        A[c]++;

    for(auto p: A) {
        if(p.second&1) {
            cout << "No" << "\n";
            return 0;
        }

    }

    cout << "Yes" << "\n";

    return 0;
    
}


Measured memory_bytes: 256
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

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

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }
    public static void main(String[] args) throws IOException {
        StringBuilder ans = new StringBuilder();
//        int t=ri();
        int t=1;
        while (t-- > 0)
        {
            int n=ri();
            int[] arr=rai(n);
            int xor=0;
            for(int i:arr)
            {
                xor^=i;
            }
            for(int i:arr)
            {
                ans.append(xor^i).append(" ");
            }
            ans.append("\n");
        }
        out.print(ans.toString());
        out.flush();

    }
}


Measured memory_bytes: 56856
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define what_is(x) cerr << #x <<" is " << x << endl;
typedef long long ll;
const int MOD = 998244353;
const double PI = 3.141592653589793;
const int INF =  1e9 + 7;
const int nax = 200005;
ll n, k;
vector<int> adj[nax];
vector<bool> vis(nax, false);
vector<bool> stk(nax, false);
vector<int> path;
stack<int> st;
int start;

// 1---->j---->i->j;

void dfs(int i) {
	stk[i] = true;
	vis[i] = true;
	st.push(i);
	for (int j : adj[i]) {
		if (stk[j]) {
			start = j;
			while (!st.empty()) {
				path.emplace_back(st.top());
				st.pop();
			}
			return;
		}
		else {
			if (!vis[j]) {
				dfs(j);
			}
		}
	}
	if (!st.empty())
		st.pop();
	stk[i] = false;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc = 1;
	// cin >> tc;
	while (tc--) {
		int j;
		cin >> n >> k;
		for (int i = 1; i <= n; i++) {
			cin >> j;
			adj[i].emplace_back(j);
		}

		dfs(1);

		reverse(path.begin(), path.end());
		// for (int el : path) {
		// 	cout << el << " ";
		// }

		int cycle_len = 0, i = 0, ok = k;
		for (i = 0; i < (int)path.size(); i++) {
			if (path[i] == start) {
				break;
			}
			k--;
		}
		if (k < 0) {
			cout << path[ok];
			return 0;
		}

		for (; i < (int)path.size(); i++) {
			cycle_len++;
		}

		k %= cycle_len;

		if (k == 0) {
			cout << start;
			return 0;
		}
		queue<int> q;
		q.push(start);
		vector<int> lev(nax, -1);
		lev[start] = 0;

		while (!q.empty()) {
			int u = q.front(); q.pop();
			for (int v : adj[u]) {
				if (lev[v] == -1) {
					lev[v] = 1 + lev[u];
					if (lev[v] == k) {
						cout << v;
						return 0;
					}
					q.push(v);
				}
			}
		}
	}
	return 0;
}




















Measured memory_bytes: 28400
//include
//------------------------------------------
#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 <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

int main() {
	int n;
	cin >> n;
	VI v(n+1);
	FOR(i,1, n) {
		cin >> v[i];
	}

	int tmp = v[0];

	int cost[100001];

	cost[1] = 0;
	cost[2] = abs(v[1] - v[2]);

	FOR(i, 3, n) {
		cost[i] = min(cost[i - 2] + abs(v[i] - v[i - 2]), cost[i - 1] + abs(v[i] - v[i - 1]));
	}

	ANS(cost[n]);


	
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
#include<numeric>
#include<complex>
#include<ctype.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void printVector(vector<ll> A){
    cout << "[vector]" << endl;
    for(int i=0; i<A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    string S;
    cin >> S;

    if(S[0] == 'A'){
        S[0] = 'a';
    }else{
        p("WA");
        return 0;
    }

    bool isExistC = false;
    if(S.length()==4){
        if(S[2]=='C'){
            isExistC = true;
            S[2] = 'c';
        }else{
            p("WA");
            return 0;
        }
    }else{
        FOR(i, 2, S.length()-1){
            if(S[i] == 'C'){
                isExistC = true;
                S[i] = 'c';
                break;
            }
        }
    }
    if(!isExistC){
        p("WA");
        return 0;
    }

    // small letter check
    bool isAllSmall = true;
    for(char c : S){
        if(isupper(c)){
            isAllSmall = false;
            
        }
    }

    if(isAllSmall){
        p("AC");
    }else{
        p("WA");
    }
    
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
s = n.times.map { gets.chomp }

ret = 0
ans = {}
s.each do |t|
  u = t.split("").sort!.join
  if ans.has_key?(u)
    ret += ans[u]
    ans[u] += 1
  else
    ans[u] = 1
  end
end

puts ret

Measured memory_bytes: 26492
#include <stdio.h>
   
int main() {
  int H , W,i,j;
   
  while(1){
      scanf("%d",&H);/*縦を入力*/
     scanf("%d",&W);/*横を入力*/
    if(H == 0 && W == 0) {/*WとHがともに真の場合*/
      break;  /*ループから抜ける*/
    }
    for(j=1; j<=H; j++) {
      for(i=1; i<=W; i++) {
    printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
   
}


Measured memory_bytes: 2620
n, m = map(int, input().split())
l = [[] for _ in range(n)]
for i in range(m):
  a, b  = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

import itertools
ans = 0
for p in itertools.permutations(range(n)):
    if p[0] == 0:
        flag = True
        for i in range(n-1):
            if not p[i+1] in l[p[i]]:
                flag = False
        if flag:
            ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(x,n) for(int x = 0; x < n; x++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) ((int)(a).size())
using namespace std;
typedef long long ll;

ll A[6] = {};

int main() {
  FOR(x,6) cin >> A[x];
  ll ans = (A[0] / 2) * 2 + A[1] + (A[3] / 2) * 2 + (A[4] / 2) * 2 + + (A[0] % 2) * (A[3] % 2) * (A[4] % 2) * 3LL;
  if((A[0] % 2) + (A[3] % 2) + (A[4] % 2) == 2) {
    if(!(A[0] % 2) && A[0])
      ans = max(ans,(A[0] / 2) * 2 + A[1] + (A[3] / 2) * 2 + (A[4] / 2) * 2 + 1);
    else if(!(A[3] % 2) && A[3])
      ans = max(ans,(A[0] / 2) * 2 + A[1] + (A[3] / 2) * 2 + (A[4] / 2) * 2 + 1);
    else if(!(A[4] % 2) && A[4])
      ans = max(ans,(A[0] / 2) * 2 + A[1] + (A[3] / 2) * 2 + (A[4] / 2) * 2 + 1);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<map>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)



map<string,int> sina;
vector<int> haigo[100];
int val[100];

int saiki(int a){
	if(haigo[a].size()==0)return val[a];
	
	int sum=0;
	for(int i=0;i<haigo[a].size();i++){
		sum += saiki(haigo[a][i]);
	}
	
	return min(sum,val[a]);
}

int main(){
	while(1){
		int n;
		cin>>n;
		
		if(n==0)break;
		
		sina.clear();
		
		rep(i,n){
			string a;
			int b;
			
			cin>>a>>b;
			sina[a]=i;
			val[i]=b;
		}
		
		int k;
		cin>>k;
		
		rep(i,100)haigo[i].clear();
		
		rep(i,k){
			string a;
			int b;
			cin>>a>>b;
			
			rep(j,b){
				string c;
				cin>>c;
				
				haigo[sina[a]].push_back(sina[c]);
			}
		}
		
		string d;
		cin>>d;
		
		printf("%d\n",saiki(sina[d]));
	}
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int,int> pii;
typedef std::pair<int,double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1000000007;


void solve(){
    int x;
    cin >> x;
    if (x >= 1800){
        cout << 1;
    }
    else if (x >= 1600){
        cout << 2;

    }
    else if (x >= 1400){
        cout << 3;
        
    }
    else if (x >= 1200){
        cout << 4;
        
    }
    else if (x >= 1000){
        cout << 5;
        
    }
    else if (x >= 800){
        cout << 6;
        
    }
    else if (x >= 600){
        cout << 7;
        
    }
    else{
        cout << 8;
        
    }
}


int main(){
    int T;
    T = 1;
    //cin >> T;
    while(T--){
        solve();
        cout << endl;
    }
}





































Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller(char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll S,c;
    cin>>S>>c;
    ll ans=0;
    if(S*2<=c) {
        ans+=S;
        S=0;
        c-=ans*2;
        ans+=c/4;
        cout<<ans<<endl;
    }
    else {
        ll h=c/2;
        c-=h*2;
        S-=h;
        ans+=h;
        cout<<ans<<endl;
    }
}

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

ll solve() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
        A[i]--;
    }
    ll ans = 0;
    for ( int i = 0; i < N; i++ ) {
        if ( A[A[i]] == i ) ans++;
    }
    ans /= 2;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
    int n;
    string s;
    cin >> n >> s;
    int a = 0, b = 0;
    rep(i,n) if(s[i] == 'R') a++;  //最初はすべてWに変えるので
    int ans = max(a,b);
    rep(i,n) {              //境界をずらす
        if(s[i] == 'R') a--;  //境界が赤になったときもとから赤の場合
        else b++;         //そうでないならBが増える
        int now = max(a,b);
        ans = min (ans,now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3724
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    S = input()
    T = input()
    ans = INF
    for i in range(len(S) - len(T) + 1):
        ans = min(ans, sum(s != t for s, t in zip(S[i : i + len(T)], T)))
    print(ans)
resolve()

Measured memory_bytes: 67964
#include<iostream>
using namespace std;
int main(){
  while(true){
    int n;
    int sum=0;
    int mx=0;
    int mn=1001;
    cin >>n;
    if(n==0)break;
    for(int i =0;i<n;++i){
      int t;
      cin >> t;
      sum += t;
      mx = max(t,mx);
      mn = min(t,mn);
    }
    sum = (sum-mx-mn) / (n-2);
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    vi a(12);
    rep(i,12)cin >> a[i];
    sort(all(a));
    if(a[0] == a[1] && a[1] == a[2] && a[2] == a[3] &&
        a[4] == a[5] && a[5] == a[6] && a[6] == a[7] &&
        a[8] == a[9] && a[9] == a[10] && a[10] == a[11]){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
}



Measured memory_bytes: 3164
#include<stdio.h>
int main(void){
	long num, sum = 0, max = -1000001, min = 1000001;
	int n, i;
	
	scanf("%d\n", &n);
	for(i = 0; i < n; i++){
		scanf("%ld", &num);
		sum += num;
		if(num > max){
			max = num;
		}
		if(num < min){
			min = num;
		}
	}
	printf("%ld %ld %ld\n", min, max, sum); 
	return 0;
}



Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
template<typename tn> void read(tn &a){
    tn x=0,f=1;char c=' ';
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
    a=x*f;
}
int n,k;
const int N=1e5+5;
char c[N];
int sum=1;
int main(){
	read(n);
	read(k);
	cin>>c;
	int len=strlen(c);
	char now=c[0];
	for(int i=1;i<len;i++)
		if(c[i]!=now) now=c[i],sum++;
	int ans=n-max(1,sum-2*k);
	printf("%d\n",ans);
	return 0;
} 

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 4000000000; //4*10^9;
constexpr auto MOD = 1000000007; //10^9+7;

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

    vvi c(10,vi(10));
    rep(i, 10)rep(j, 10) c[i][j] = 0;

    rep(i, n) {

        int k = i + 1;

        int kt = k, kb;

        while (kt >= 10)kt /= 10;
        kb = k % 10;

        c[kt][kb]++;
    }

    int ans = 0;

    rep(i, 10)rep(j, 10) ans +=( c[i][j]*c[j][i]);

    cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define rer(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<int, pi> ppi;
typedef vector<ll> vi;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest) { 
	cout << arg << " "; Debug(rest...); }
template<class T>ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<< ", ";out<<v.back();}out << "]";return out;}
template<class S, class T>ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";return out;}
const int MAX_N = 200010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M, D;
char C[2][2] = {
	{'R', 'Y'},
	{'G', 'B'}
};

void solve() {
	cin >> N >> M >> D;
	rep(i, 0, N) {
		string res;
		rep(j, 0, M) {
			int d = 2  * D;
			int x = ((i - j) % d + d) % d;
			int y = (i + j) % d;
			res += C[x < D][y < D];
		}
		cout << res << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(5);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 512
import sys



fin = sys.stdin.readline
N = int(fin())
S = fin().rstrip("\n")
assert len(S) == N

WHITE, BLACK = 0, 1
# 満たしている状態での処理数
min_changes_at = [[float('inf')] * 2 for _ in range(N)]
min_changes_at[-1] = [1, 0] if S[-1] == "#" else [0, 1]

for i in reversed(range(len(S) - 1)):
    color = S[i]
    if color == "#":
        min_changes_at[i][WHITE] = min(min_changes_at[i + 1]) + 1
        min_changes_at[i][BLACK] = min_changes_at[i + 1][BLACK]
    else:  # WHITE
        min_changes_at[i][WHITE] = min(min_changes_at[i + 1])
        min_changes_at[i][BLACK] = min_changes_at[i + 1][BLACK] + 1
# print(min_changes_at)
print(min(min_changes_at[0]))

Measured memory_bytes: 78272
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>
#include<experimental/any>
#include<cstring>
#include<cctype>
#include<ctime>
#include<cstdbool>
#include<cstdint>
#include<cstddef>
#include<set>
#include<unordered_set>
#include<bitset>
 
using namespace std;
using experimental::any;
 
#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);
 
#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)
#define BitFOR(N) REP(Bit,1<<(N))
 
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) (f)? cout<<"true ":cout<<"false ";
#define FORDEB(n,X) for(int i=0;i<(n);i++)ARDEB(i,X)
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define ARDEB(i,X) {}
#define TFDEB(f) {}
#define FORDEB(n,X) {}
#define END {}
#endif
 
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
//struct edge{int from,cost,to;};
struct P2{int x,y;};
#define BIT(Bit,n) bitset<n>(Bit)
#define Endl endl
 
const int MOD7=1000000007;
const int INF=100000000;
const int SET=1000;
 
int main(){
	ll n,m,a[100000],b[100000],num[100010]={},ans=0,last;
	bool f=false;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		num[a[i]-1]+=b[i];
	}
	REP(i,5){ARDEB(i,num)END}
	for(int i=0;i<1000000;i++){
		DEB(i)END
		if(i!=0){num[i]+=num[i-1];DEB(i)END}
		if(num[i]>=m){
			cout<<i+1<<endl;
			return 0;
		}
		if(i<5){ARDEB(i,num)END}
	}
	return 0;
}
//1,2,4,8,16

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int MAX_N = 200200;

int n;
vector<int> to[MAX_N];
vector<int> cnt(MAX_N);
vector<int> parent(MAX_N);

void init(){
    rep(i,MAX_N){
        cnt[i] = 0;
        parent[i] = -100;
    }
}

void decide_pare(int u){
    if(u == 0) parent[u] = -1;
    for(int d: to[u]){
        if(parent[d] == -100){
            parent[d] = u;
            decide_pare(d);
        }
    }
    
}

/*
void dfs(int u, int x){
    cnt[u] += x;
    for(int d: to[u]){
        if(d != parent[u]) dfs(d, x);
    }
}
*/

void dfs(int u){
    for(int d: to[u]){
        if(d != parent[u]){
            cnt[d] += cnt[u];
            dfs(d);
        }
    }
}

int main()
{
    cin >> n;
    int q; cin >> q;
    rep(i,n-1){
        int a, b; cin >> a >> b; --a, --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    init();
    decide_pare(0);

    /*
    cout << "親が決定しました" << endl;
    rep(i,n) cout << parent[i] << endl;
    */

    rep(_,q){
        int p, x; cin >> p >> x; --p;
        cnt[p] += x;
    }

    dfs(0);

    rep(i,n){
        cout << cnt[i];
        if(i != n-1) cout << " ";
    }cout << endl;
}

Measured memory_bytes: 25132
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1e9+7;

int main() {
  int k,x;
  cin>>k>>x;
  rep(i,k-1) cout<<x-k+1+i<<" ";
  cout<<x<<" ";
  rep(i,k-1) cout<<x+i+1<<" ";
  cout<<endl;
  return 0;
}


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

#define int long long
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vii vector<vector<int>>
#define pr pair<int,int>
#define endl "\n"
#define sz(x) (int)(x).size()
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
#define all(c) (c).begin(), (c).end()

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)


const int MOD = 1e9 + 7 ;
const int INF = 0;
const int MAXN = 1e5 + 10;

using namespace std;



int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int i,j,k;
    cin >> i >> j >> k;

    int z = i*j;

    if(z >= k) cout<<k<<endl;
    else cout<<z<<endl;
    return 0;
}
// CHECK FOR CORNER CASES LIKE 0,1 etc.


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
main()
{
	int N,M,s=0;
	cin>>N>>M;
	vector <int> A(M);
	for(int i=0;i<M;i++)
	{
		cin>>A[i];
	}
	for(int i=0;i<M;i++)
	{
		s=s+A[i];
	}
	if(s<=N)
	{
		cout<<N-s<<endl;
	}
	else
	{
		cout<<-1<<endl;
	}
}

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

using namespace std;

int main(void){
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i = 0; i < H; i++) cin >> S[i];
    vector<vector<int>> L(H, vector<int>(W, 0)), R(H, vector<int>(W, 0)), U(H, vector<int>(W, 0)), D(H, vector<int>(W, 0));
    for(int i = 0; i < H; i++){
        for(int j = 1; j < W; j++){
            if(S[i][j] == '.' && S[i][j - 1] == '.') L[i][j] = L[i][j - 1] + 1;
        }
        for(int j = W - 2; j >= 0; j--){
            if(S[i][j] == '.' && S[i][j + 1] == '.') R[i][j] = R[i][j + 1] + 1;
        }
    }
    for(int i = 0; i < W; i++){
        for(int j = 1; j < H; j++){
            if(S[j][i] == '.' && S[j - 1][i] == '.') U[j][i] = U[j - 1][i] + 1;
        }
        for(int j = H - 2; j >= 0; j--){
            if(S[j][i] == '.' && S[j + 1][i] == '.') D[j][i] = D[j + 1][i] + 1;
        }
    }
    int ans = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(S[i][j] == '.'){
                ans = max(ans, 1 + L[i][j] + R[i][j] + U[i][j] + D[i][j]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int a[100000] = {0};
int main()
{
  	int n;
  	cin>>n;
  	int c[n];
  	for(int i = 0; i < n; i++)
    {
      	cin>>c[i];
  		a[c[i]]++;
    }
  	long long int res = 0;
  	for(int i = 0; i < 100000; i++)
      	if(a[i] > 0)
          	res++;
  	if(res % 2 == 0)
      	cout<<res-1<<"\n";
  	else 
      	cout<<res<<"\n";
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int  main(){
 int a,b;
 cin >> a >> b;
 int count = 1;
 int ans = 0;
 while(count<b){
     --count;
     count +=a;
     ans ++;
 }
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int s,tmp,tmp1,tmp2;
	scanf("%d",&s);
	
	tmp=s/3600;
	tmp1=(s-tmp*3600)/60;
	tmp2=s-tmp*3600-tmp1*60;

	printf("%d:%d:%d\n",tmp,tmp1,tmp2);
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  int s;
  s = e - a;
  
  if(s > k){
    cout << ":(" << endl;
  }
  else{
    cout << "Yay!" << endl;
  }
}


Measured memory_bytes: 256
use std::io;

fn get_line() -> String {
  let mut line = String::new();
  io::stdin()
    .read_line(&mut line)
    .unwrap();
  line
}

fn line_to_vec_i64(line: &str) -> Vec<i64> {
  line
    .trim()
    .split_whitespace()
    .map(|val| { val.parse::<i64>().unwrap() })
    .collect()
}

fn main() {
  let _n = get_line();
  let mut v = line_to_vec_i64(&get_line());
  v.sort();
  let (min, max) = (v[0], v[v.len() - 1]);
  let sum: i64 = v.iter().sum();
  println!("{} {} {}", min, max, sum);
}



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

int main(){
  int n;
  cin >> n;
  string s;
  int d= 0;
  map<string,int> m;
  rep(i,n) {
    cin >> s;
    m[s]++;
    d = max(d,m[s]);
  }
  vector<string> ans;
  for(auto x : m) {
    if(x.second == d) ans.push_back(x.first);
  }
  sort(ans.begin(),ans.end());
  for(auto t : ans) cout << t << endl;
  return 0;
}

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

int main() {
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i,h) cin >> c[i];
  int ans = 0;
  rep(is, 1<<h){
    rep(js, 1<<w){
      int black = 0;
      rep(i,h){
        rep(j,w){
          if(is>>i&1)continue;
          if(js&(1<<j))continue;
          if(c[i][j] == '#') black++;
        }
      }
      if(black == k) ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
どうやっても同じになる
*/

ll n,m;
ll d[200010],c[200010];
ll ans=0,csum=0,digit_sum=0;

int main(void){
	cin>>m;
	rep(i,m)cin>>d[i]>>c[i];
	rep(i,m){
		digit_sum+=d[i]*c[i];
		csum+=c[i];
	}
	cout<<csum-1+(digit_sum-1)/9<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,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(ll i=0;i<x;i++)
#define repn(i,x) for(ll 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())

const int MAX = 510000;
const int MOD = 1000000007;
const int D = 70;

ll to[D][MAX];

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

  // to[i][j] = j kara 2^i回の操作でいく場所
  rep(i, N){ cin >> to[0][i]; to[0][i]--;}
  rep(i,D - 1) rep(j,N) to[i + 1][j] = to[i][to[i][j]];

  ll now = 0;
  bitset<65> tmp(K);
  rep(i,65){
    if(tmp.test(i)) now = to[i][now];
  }
  cout << now + 1 << endl;
}


Measured memory_bytes: 113192
#include <stdio.h>

int main(void){
  int num1[1001],num2[1001];
  int i,c,d;
  char str[1001];
  for(i=0;i<1001;i++){
    num1[i]=0;
    num2[i]=0;
  }
  while(fgets(str,sizeof(str),stdin)!=NULL){
    //printf("%s\n",str);
    if(str[0]<48||str[0]>57) break;
    else{
      sscanf(str,"%d,%d",&c,&d);
      //printf("//%d %d\n",c,d);
      num1[c]++;
    }
  }

  while(scanf("%d,%d",&c,&d)!=EOF){
    num2[c]++;
  }

  for(i=1;i<1001;i++){
    if(num1[i]!=0 && num2[i]!=0){
      printf("%d %d\n",i,num1[i]+num2[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 620
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

class node {
  public:
    int key;
    node *p;
    node *l;
    node *r;
};
node *NIL, *root;

void insert(int k) {
    node *y = NIL;
    node *x = root;
    node *z = new node;
    z->key = k;
    z->l = NIL;
    z->r = NIL;
    while(x != NIL) {
        y = x;
        if(z->key < x->key)
            x = x->l;
        else
            x = x->r;
    }

    z->p = y;

    if(y == NIL) {
        root = z;
    } else if(z->key < y->key) {
        y->l = z;
    } else {
        y->r = z;
    }
}

void traverse(node *now, int order) {

    if(order == 0) cout << " " << now->key; // preorder
    if(now->l != NIL) traverse(now->l, order);
    if(order == 1) cout << " " << now->key; // inorder
    if(now->r != NIL) traverse(now->r, order);
    if(order == 2) cout << " " << now->key; // postorder
}

node *find(int k) {
    node *x = root;
    while(x != NIL && x->key != k) {
        x = x->key > k ? x->l : x->r;
    }
    return x;
}

void print() {
    traverse(root, 1);
    cout << endl;
    traverse(root, 0);
    cout << endl;
}

void dele(int k) {}

int main() {
    int n, k;
    string o;
    cin >> n;
    node *a;

    rep(i, n) {
        cin >> o;
        if(o == "insert") {
            cin >> k;
            insert(k);
        } else if(o == "find") {
            cin >> k;
            a = find(k);
            cout << (a != NIL ? "yes\n" : "no\n");
        } else if(o == "print") {
            print();
        }
    }
}



Measured memory_bytes: 21912
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#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 REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}
char maze[200][200];
char gyo[100];
int main() {
	int  H, W;
	cin >> H >> W;
	int h = H, w = W;
	int cnt = 0;
	REP(i,H) {
		REP(j, W) {
			cin >> gyo[j];
		}
		bool white = true;
		REP(j, W) {
			if (gyo[j] == '#')white = false;
		}
		if (white) {
			h--;
			continue;
		}
		else {
			REP(j, W) {
				maze[cnt][j] = gyo[j];
			}
			cnt++;
		}
	}

	int c = 0;
	int cntt = 0;
	REP(i, W) {
		bool white = true;
		REP(j, h) {
			if (maze[j][c] == '#')white = false;
		}
		if (white) {
			REP(l, h) {
				for (int k = c; k < w-1; k++) {
					maze[l][k] = maze[l][k + 1];
				}
			}
			w--;
		}
		else c++;
		cntt++;
		if (cntt >= W)break;
	}
	REP(i, h) {
		REP(j, w) {
			cout << maze[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 256