akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

ll ans;
string S;

void dfs(ll i,ll sum){
  if(i==S.size()){
    ans+=sum;
    return;
  }
  Rep(j,i+1,S.size()+1){
    dfs(j,sum+stoll(S.substr(i,j-i)));
  }
}

int main(){
  cin >> S;
  dfs(0,0);
  cout << ans << endl;
}

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

int main(){
  string s;
  cin>>s;
  bool flag=true;
  for(int i=1;i<s.length();i++){
    for(int j=i-1;j>=0;j--){
      if(s[i]==s[j]){
        flag=false;
      }
    }
  }
  
  cout<< (flag?"yes":"no") <<endl;
  return 0;
}
	

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

int main(){
  int N;
  cin >> N;
  vector<tuple<string,int,int>>SP(N);
  for (int i=0;i<N;i++){
    string s;
    int p;
    cin >> s >> p;
    SP.at(i) = make_tuple(s,p,i+1);
  }
  sort(SP.begin(),SP.end());
  vector<int>checked(N);
  for (int i=0;i<N;i++){
    string s1;
    s1 = get<0>(SP.at(i));
    for (int j=N-1;j>=0;j--){
      string s2;
      s2 = get<0>(SP.at(j));
      if (s2 == s1){
        int k;
        k = get<2>(SP.at(j));
        bool check=false;
        for (int l=0;l<checked.size();l++){
          if (checked.at(l) == k){
            check = true;
          }
        }
        if (!check){
          cout << k << endl;
          checked.push_back(k);
        }
      }else{
        continue;
      }
    }
  }
}


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

int main() {
    int N,Q,ans=0;
    cin>>N>>Q;
    int l[Q],r[Q],a[N];
    string s;
    int count1=0,count2=0;
    cin >> s;
    for(int i=0;i<Q;i++){
      cin>>l[i]>>r[i];
    }

    for (int i=0;i<N;i++){
      if(i==0) a[i]=0;
      else if(s[i]=='C' && s[i-1]=='A') a[i]=a[i-1]+1;
      else a[i]=a[i-1];
    }

    for (int i=0;i<Q;i++){
      ans=a[r[i]-1]-a[l[i]-1];
      cout<<ans<<endl;
    }

}


Measured memory_bytes: 2176
import java.io.*;
import java.util.*;

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok;

    public void go() throws IOException
    {
        ntok();
        int n = ipar();
        ntok();
        String s = spar();
        int[][] dp = new int[n+1][n+1];
        int best = 0;
        for (int i = n-1; i >= 0; i--)
        {
            for (int e = n-1; e >= 0; e--)
            {
                if (s.charAt(i) == s.charAt(e) && (e-i) > dp[i+1][e+1])
                {
                    dp[i][e] = dp[i+1][e+1] + 1;
                }
                else 
                {
                    dp[i][e] = 0;
                }
                best = Math.max(best, dp[i][e]);
            }
        }
        out.println(best);

        out.flush();
        in.close();
    }

    public void ntok() throws IOException
    {
        tok = new StringTokenizer(in.readLine());
    }

    public int ipar()
    {
        return Integer.parseInt(tok.nextToken());
    }

    public int[] iapar(int n)
    {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = ipar();
        }
        return arr;
    }

    public long lpar()
    {
        return Long.parseLong(tok.nextToken());
    }

    public long[] lapar(int n)
    {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = lpar();
        }
        return arr;
    }

    public double dpar()
    {
        return Double.parseDouble(tok.nextToken());
    }

    public String spar()
    {
        return tok.nextToken();
    }

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


Measured memory_bytes: 168256
x1,y1=map(int,input().split())
x2,y2=map(int,input().split())
x3,y3=map(int,input().split())

from math import sqrt

d1=sqrt((x2-x3)**2+(y2-y3)**2)
d2=sqrt((x1-x3)**2+(y1-y3)**2)
d3=sqrt((x1-x2)**2+(y1-y2)**2)

l=max(d1,max(d2,d3))

def cos(x,y,z):
    return (y**2+z**2-x**2)/(2*y*z)

c1=cos(d1,d2,d3)
c2=cos(d2,d1,d3)
c3=cos(d3,d2,d1)

c1=sqrt((1+c1)/2)
c2=sqrt((1+c2)/2)
c3=sqrt((1+c3)/2)

ct1=sqrt(1/(1/(c1**2)-1))
ct2=sqrt(1/(1/(c2**2)-1))
ct3=sqrt(1/(1/(c3**2)-1))

r=max(d1/(2+ct2+ct3),max(d2/(2+ct1+ct3),d3/(2+ct2+ct1)))

print(r)


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

int main()
{
  int K;
  string S;
  cin >> K >> S;
  int n = S.size();
  if (n <= K)
  {
    cout << S << endl;
  }
  else
  {
    cout << S.substr(0, K) << "..." << endl;
  }
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vi a(n), b(n);
  REP(i, n) {
    cin >> a[i];
  }
  REP(i, n) {
    cin >> b[i];
  }

  map<int, int> mp;
  REP(i, n) {
    mp[a[i]]++;
    mp[b[i]]++;
  }

  bool ok = true;
  for(auto &e: mp) {
    if(e.second > n) {
      ok = false;
    }
  }
  if(!ok) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;

  reverse(ALL(b));
  int x = -1;
  vector<int> st;
  vector<bool> sel(n);
  REP(i, n) {
    if(a[i] == b[i]) {
      x = a[i];
      st.push_back(i);
      sel[i] = true;
    }
  }
  if(x == -1) {
    cout << b << endl;
    return 0;
  }

  int pos = 0;
  REP(i, n) {
    if(sel[i]) continue;
    if(a[i] != x && b[i] != x) {
      swap(b[i], b[st[pos]]);
      pos++;
      if(pos == SZ(st)) break;
    }
  }
  cout << b << endl;



  return 0;
}








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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    string S;
    cin >> S;
    ll N, K;
    cin >> K;
    N = S.size();
    vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(2, vector<ll>(N + 1, 0)));
    dp[0][0][0] = 1;
    rep(i, N) {
        ll d = S[i] - '0';
        rep(j, 2) {
            if (j == 1) {
                d = 9;
            }
            rep(k, K + 1) {
                rep(m, d + 1) {
                    dp[i + 1][j == 1 || m < d][(m != 0 ? k + 1: k)] += dp[i][j][k];
                }
            }
        }
    }
    ll ans = dp[N][0][K] + dp[N][1][K];
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>

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

using namespace std;

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

const int N = 205;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;

ll baza[N], A[N];
char s[N];
int sz, n;

void ubaci(ll x){
	for(int i = 0;i < 62;i++){
		if((x & (1LL << i)) == 0)
			continue;
		if(!baza[i]){
			baza[i] = x;
			sz++;
		}
		x ^= baza[i];
	}
}

bool query(ll x){
	for(int i = 0;i < 62;i++){
		if((x & (1LL << i)) == 0) continue;
		if(!baza[i]) return 0;
		x ^= baza[i];
	}
	return 1;
}

void solve(){
	memset(baza, 0, sizeof(baza));
	sz = 0;
	scanf("%d", &n);
	for(int i = 0;i < n;i++)
		scanf("%lld", A + i);
	scanf("%s", s);
	for(int i = n - 1;i >= 0;i--){
		if(s[i] == '0') 
			ubaci(A[i]);
		else{
			if(!query(A[i])){
				printf("1\n");
				return;
			}
		}
	
	}
	printf("0\n");
	return;
}

int main(){
	int T; scanf("%d", &T);
	for(;T--;) solve();
	return 0;
}

Measured memory_bytes: 3664
fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    n %= 10
    if(n == 1 || n == 0 || n == 6 || n == 8) {
        println("pon")
    } else if(n == 3) {
        println("bon")
    } else {
        println("hon")
    }
}

Measured memory_bytes: 34484
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string a;
    cin>>a;
    if(a.at(2)==a.at(3)&&a.at(4)==a.at(5)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;


int main(){
  int W,a,b,ans;
  cin>>W>>a>>b;

  ans=max(a,b)-min(a,b)-W;

  if(ans<0) ans=0;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	deg := make([]int, n)
	cc := make([][]int, n)

	for i := 0; i < n+m-1; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		cc[a] = append(cc[a], b)

		deg[b]++
	}

	q := make([]int, 0)
	for i := 0; i < n; i++ {
		if deg[i] == 0 {
			q = append(q, i)
			break
		}
	}

	ans := make([]int, n)
	for len(q) > 0 {
		p := q[0]
		q = q[1:]
		for _, to := range cc[p] {
			deg[to]--
			if deg[to] > 0 {
				continue
			}
			q = append(q, to)
			ans[to] = p + 1
		}
	}
	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, ans[i])
	}
}


Measured memory_bytes: 11392
#include <bits/stdc++.h>		//线段树维护区间和
#define ll long long
#define inf 0x3f3f3f3f 
using namespace std;
const int maxn = 1e5+10;

int main(){
	int k;
	scanf("%d", &k);
	ll n = 7;
	int ans = 1;
	if(k%2==0 || k%5==0){
		printf("-1");
		return 0;
	}
	while(1){
		if(n % k==0){
			printf("%d", ans);
			break;
		}
		ans ++;
		n = n*10+7;
		n%=k;
	}

	return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int main(){
  string S; cin>>S;
  int a[2]={};
  rep(i,3){
    a[S[i]-'A']++;
  }
  if(a[0]==0||a[1]==0) cout<<"No\n";
  else cout<<"Yes\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
#include <string>
#include <vector>

int main() {
	ll N, b, r;
	cin >> N >> b >> r;
	
	if (N % (b + r) > b)cout << N / (b + r)*b + b << endl;
	if (N % (b + r) <= b)cout << N / (b + r)*b + N % (b + r) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()

using namespace std;

int main() {
  string c1, c2;
  cin >> c1 >> c2;
  reverse(c1.begin(), c1.end());

  puts(c1 == c2 ? "YES" : "NO");

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	reverse(s.begin(), s.end());
	
	int n = s.size();
	vector<ll> cnt(2019, 0);
	ll cur = 0LL, ten = 1LL;
	cnt[0]++;
	
	for(int i = 0; i < n; ++i) {
		cur = (cur + (ll)(s[i] - '0') * ten % 2019) % 2019;
		ten = (ten * 10) % 2019;
		cnt[cur]++;
	}
	
	ll ans = 0LL;
	for(int i = 0; i < 2019; ++i) {
		ans += cnt[i] * (cnt[i] - 1) / 2LL;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3732
n = gets.to_i
n.times {
    a = gets.split.map(&:to_i)
    x = y = 0
    ok = true
    a.each{|z|
        if z < [x, y].min
            ok = false
            break
        end

        if z > [x, y].max
            x, y = [x, y].min, z
        else
            x, y = [x, y].max, z
        end
    }
    puts ok ? "YES" : "NO"
}

Measured memory_bytes: 6104
#include<iostream>
#include<cstdio>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int N=100100;
int n,K,L;
char x,s[N],t[N],a[N],b[N];
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d%d%s",&n,&K,s+1);
	if(n==1) return puts(s+1),0;
	a[1]=x='z'+1;
	FOR(i,1,n) x=min(x,s[i]),s[i+n]=s[n-i+1];
	if(K>=14){FOR(i,1,n) putchar(x);return 0;}
	for(int l=1,r;l<=n;l=r+1){
		for(r=l;r<n && s[r]==s[r+1];r++);
		if(s[l]>x) continue;
		L=(1<<K-(r<n))*(r-l+1);
		if(L>=n){
			FOR(i,1,n) putchar(x);
			return 0;
		}
		FOR(i,1,L) b[i]=x;
		FOR(i,1,n-L) b[i+L]=r<n?s[2*n-r+1-i]:s[l-i];
		//cout<<l<<' '<<r<<' '<<L<<'\n';puts(s+1);puts(b+1);
		FOR(i,1,n)if(b[i]!=a[i]){
			if(b[i]<a[i]) FOR(j,1,n) a[j]=b[j];
			break;
		} 
	}
	puts(a+1);
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x[3];
    cin>>x[0]>>x[1]>>x[2];
    sort(x,x+3);
    int ans=0;
    ans+=(x[2]-x[0])/2;
    ans+=(x[2]-x[1])/2;
    x[0]+=(x[2]-x[0])/2*2;
    x[1]+=(x[2]-x[1])/2*2;
    sort(x,x+3);
    if(x[0]==x[1]){
        if(x[0]==x[2])cout <<ans<<"\n";
        else cout <<ans+1<<"\n";
    }
    else{
        cout <<ans+2<<"\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

int main() {
	int r; std::cin >> r;
	std::cout << 3 * r * r << std::endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<sstream>
#include<vector>
#include<ctime>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int inf=0x3f3f3f3f;
int main()
{
	IOS;
	string x[100007];
	map<int,int>wa;
	int k,n;
	cin>>k>>n;
	string s;
	int a;
	int sumac=0,sumwa=0;
	for(int i=0;i<n;i++)
	{
		cin>>a>>s;
		if(x[a]=="AC") 
		{
			continue;
		}
		else if(s=="AC") x[a]=s,sumac++,sumwa+=wa[a];
		else
		{
			x[a]=s;
			if(s=="WA") wa[a]++;
			else sumac++;
		}
	}
	cout<<sumac<<" "<<sumwa<<endl;
	return 0;
}


Measured memory_bytes: 10368
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// 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 (b < a) { a = b; return 1; } return 0; }




// ***************************************


int main(){

    ll N;
    cin >> N;
    set<string> S;

    REP(i, N){
        string s;
        cin >> s;
        S.insert(s);
    }

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

    return 0;
}


Measured memory_bytes: 19224
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int a[305]={0};
a[1]=300000;
a[2]=200000;
a[3]=100000;

int x,y;
cin>>x>>y;
int ans=a[x]+a[y];
if(x==1&&y==1)
{
	ans+=400000;
}
ol(ans);
return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define inf 1000000000000000
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, m, i, j;
    cin >> n >> m;
    ll v = (1 << n) - 1;
    vll a(m), x(m);
    vector <vll> dp(m);
    for(i = 0; i < m; i++)
    {
        dp[i].resize(v + 1, inf);
        ll mask, b;
        cin >> a[i] >> b;
        for(j = 0; j < b; j++)
            cin >> mask, x[i] += (1 << (mask - 1));
    }
    dp[0][0] = 0, dp[0][x[0]] = a[0];
    for(i = 0; i < m - 1; i++)
    {
        for(j = 0; j <= v; j++)
        {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
            dp[i + 1][j | x[i + 1]] = min(dp[i + 1][j | x[i + 1]], dp[i][j] + a[i + 1]);
        }
    }
    if(dp[m - 1][v] == inf)
        cout << -1 << endl;
    else
        cout << dp[m - 1][v] << endl;
    return 0;
}

Measured memory_bytes: 32384
x = int(input())

if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)


Measured memory_bytes: 9120
"""
 // Author : snape_here - Susanta Mukherjee
 // Date : 27/07/2019

"""
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

    
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading


# For getting input from input.txt file 
#sys.stdin = open('input.txt', 'r')  
  
# Printing the Output to output.txt file 
#sys.stdout = open('output.txt', 'w') 

def ii(): return int(input())
def fi(): return float(input())
def si(): return str(input())
def mi(): return map(int,input().split())
def li(): return list(mi())

def main():
    
    n=ii()
    s=len(str(n))
    n=int(n)
    if s==1:
        ans=n 
    elif s==2:
        ans=9 
    elif s==3:
        ans=10+(n-100)
    elif s==4:
        ans=909 
    elif s==5:
        ans=910+(n-10000)
    elif s==6:
        ans=90909
    print(ans)

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        if self.buffer.tell():
            return self.buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;

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

  int ans=0;
  for(int i = 0; i <= K; i++){
    for(int j = 0; j <= K; j++){
      if(S-i-j>=0 && S-i-j<=K)ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>

int main(void){
  int a[6];
  int count = 0;
  for(int i = 0; i < 6; i++)
    std::cin >> a[i];
  for(int i = 0; i < 5; i++)
    for(int j = i + 1; j < 5; j++){
      if(a[j] - a[i] > a[5])
        count++;
    }
  std::cout << ((count == 0) ? "Yay!" : ":(") << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 1e3 + 50;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int LN = 22;
const int SN = 320;

long long n, m, u, v, k, t, q, x, d, p, a, b, c, s;


string str;

int level[N][N];

void solve(int l, int r, int lvl) {
   if (l == r) return;
   int n = (r - l) / 2;
   for (int i = l; i <= l + n; ++i) {
      for (int j = l + n + 1; j <= r; ++j) {
         level[i][j] = lvl;
      }
   }
   
   solve(l, l + n, lvl + 1);
   solve(l + n + 1, r, lvl + 1);
}

int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n;
   solve(1, n, 1);
   
   for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) cout << level[i][j] << " ";
      cout << endl;
   }
}


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


using namespace std;

int main(){

	long N;
	vector<tuple<long long, long long, long long>> A;

	cin >> N;

	for(long i=0;i<N;i++){
		long long x, y;
		cin >> x >> y;
		A.push_back(make_tuple(x + y, x, y));
	}

	sort(A.begin(), A.end());

	long long ans = 0;
	for(long i = 0; i < N; i++){
		if(i % 2 == 0){
			ans += get<1>(A[N-1-i]);
		} else {
			ans -= get<2>(A[N-1-i]);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4212
import java.util.Scanner;

public class Main{
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt()*2;
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = C*Math.max(X,Y);
		int ans2 = C*Math.min(X,Y);
		if(X<Y) {
			ans2 += Math.abs(Y-X)*B;
		} else {
			ans2 += Math.abs(Y-X)*A;
		}
		int ans3= A*X+B*Y;
		System.out.println(Math.min(ans1,Math.min(ans2, ans3)));
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int n,k;
  string s;
  cin >> n >> k >> s;
  if(s[k-1]=='A') s[k-1]='a';
  else if(s[k-1]=='B') s[k-1]='b';
  else if(s[k-1]=='C') s[k-1]='c';
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstdint>
using namespace std;


uint64_t find_idx(vector<uint64_t> & v, uint64_t val) {
  uint64_t a = 0;
  uint64_t b = v.size();
  while (b > a) {
    uint64_t mid = (b + a) / 2;
    if (v[mid] < val) {
      b = mid;
    } else {
      a = mid + 1;
    }
  }

  return a;
}


int main()
{
  uint64_t n;

  cin >> n;
  vector<uint64_t> v;
  vector<uint64_t> s;
  v.resize(n + 1);
  for (uint64_t i = 1; i <= n; ++i) {
    cin >> v[i];
  }
  for (uint64_t i = 1; i <= n; ++i) {
    auto j = find_idx(s, v[i]);
    if (j >= s.size()) {
      s.push_back(v[i]);
    } else {
      s[j] = v[i];
    }
  }
  cout << s.size() << endl;

  return 0;
}



Measured memory_bytes: 2168
h,w = gets.chomp.split(' ').map(&:to_i)
mtrx = []
h.times do
  row = gets.chomp.split('')
  if row.uniq != ["."]
    mtrx.push(row)
  end
end
new_mtrx = mtrx.transpose
new_mtrx.each do |column|
  if column.uniq == ["."]
    new_mtrx.delete(column)
  end
end
new_mtrx.transpose.each do |row|
  puts row.join
end

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

int main(void){
    int N, T;
    cin >> N >> T;
    int cost = 100000;
    int c, t;
    for(int i=0; i<N; i++){
        cin >> c >> t;
        if(c < cost && t <= T){
            cost = c;
        }
    }
    if(cost == 100000){
        cout << "TLE" << endl;
    }else{
        cout << cost << endl;
    }

    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

// 解説をﾁｮｯﾄﾐﾀ(ゆるして)

struct node {
	int val;
	node *left, *right;
	node() : val(-1), left(NULL), right(NULL) {}
};

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

	int n, q;
	cin >> n >> q;

	vector<int> a(n);
	for (auto &v : a) {
		cin >> v;
		v--;
	}

	vector<node*> nodes(n);
	for (int i = 0; i < n; i++) {
		nodes[i] = new node();
	}

	node *head = new node();
	node *tail = new node();

	for (int i = 0; i < n; i++) {
		if (i > 0) {
			nodes[a[i]]->left = nodes[a[i - 1]];
		} else {
			head = nodes[a[i]];
		}

		if (i + 1 < n) {
			nodes[a[i]]->right = nodes[a[i + 1]];
		} else {
			tail = nodes[a[i]];
		}

		nodes[a[i]]->val = a[i];
	}

	for (int i = 0; i < q; i++) {
		int query;
		cin >> query;
		query--;

		if (nodes[query] == head) {
			nodes[query]->left = tail;
			tail->right = nodes[query];

			nodes[query]->right->left = NULL;

			head = nodes[query]->right;
			nodes[query]->right = NULL;
			tail = nodes[query];
		} else if (nodes[query] == tail) {
			nodes[query]->right = head;
			head->left = nodes[query];

			nodes[query]->left->right = NULL;

			tail = nodes[query]->left;
			nodes[query]->left = NULL;
			head = nodes[query];
		} else {
			nodes[query]->left->right = NULL;
			swap(nodes[query]->left, tail);
			nodes[query]->left->right = nodes[query];

			nodes[query]->right->left = NULL;
			swap(nodes[query]->right, head);
			nodes[query]->right->left = nodes[query];
		}
	}

	node* cur = head;
	while (cur != NULL) {
		cout << cur->val + 1;
		if (cur->right) cout << " ";
		cur = cur->right;
	}
	cout << endl;
	return 0;
}



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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;




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

	int a,b,x,y;cin>>a>>b>>x>>y;

	int c=0;
	if(a ==2*x && b==2*y ){
		c =1;
	}
	printf("%.10f", (double)a*(double)b/2);
	printf(" ");

	printf("%d\n",c);

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef complex<int> cli;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr> PQ;
const int SIZE=5+1*1e5;
const LL INF=1<<30;
int x[SIZE],y[SIZE];
int N,A,B;
LL ans[SIZE];
class UnionFind{
 
	vector<int> unions,talls,sents,dists,sizes;
	int size;
public:
	UnionFind(){}
	UnionFind(int size):size(size){
		init();
	}
	void init(){
	 	unions=vector<int>(size);
	 	talls=vector<int>(size);
	 	sents=vector<int>(size);
	 	dists=vector<int>(size);
	 	sizes=vector<int>(size);
		FOR(i,0,size){
			unions[i]=i;
			sents[i]=0;
			sizes[i]=1;
//			ns[i].PB(pr(0,1));
			talls[i]=1;
		}
	}
	int find(int x,int t=0){
		if(unions[x]==x || sents[x]>t) return x;
		return find(unions[x],t);
 
	}
	int minisize(int x){
		if(x==unions[x]) return sizes[x];
		return minisize(find(x));
	}
	bool isFriend(int a,int b,int t=0){
		return find(a,t)==find(b,t);	
	}
	void unite(int a,int b,int t=0){
		if(isFriend(a,b,t)) return;
		a=find(a,t);
		b=find(b,t);
		if(talls[a]<talls[b]) unite(b,a,t);
		else{
 			sizes[a]+=sizes[b];
			sents[b]=t;
			talls[a]=max(talls[a],talls[b]+1);
			unions[b]=a;
			dists[b]=1;
//			ns[a].PB(pr(t,ns[b].back().second+ns[a].back().second));
		}
	}
};

UnionFind uf;
int mdist(int a,int b){
	return abs(x[a]-x[b])+abs(y[a]-y[b]);
}
void inpile(Vpr& a,Vpr& b,int dist){
	LL s=0,e=-1;
	int now=0;
	int nowuf=0;
	REP(i,a.size()){
		int now=a[i].first;
		while (s!=b.size() && now-b[s].first>dist) s++; 
		while ((e+1)!=b.size() && b[e+1].first-now<=dist) e++;
		if(s<=e) uf.unite(a[i].second,b[s].second);
		while(nowuf<e){
			if(nowuf>=s) uf.unite(b[nowuf].second,b[nowuf+1].second);
			nowuf++;
		}
		ans[a[i].second]+=e-s+1;
	}
}
Vpr xs[SIZE],ys[SIZE];
map<int,int> mpx,mpy;
void add(Vpr *v,map<int,int>& mpi,int tar,int val,int index){
	if(mpi.count(tar)==0){
		mpi[tar]=mpi.size()+1;
	}
	v[mpi[tar]].PB(pr(val,index));
}
int main(){
	cin >> N >> A >> B;
	uf=UnionFind(N+1);
	REP(i,N){
		cin >> x[i+1] >> y[i+1];
		add(xs,mpx,x[i+1]+y[i+1],x[i+1]-y[i+1],i+1);
		add(ys,mpy,x[i+1]-y[i+1],x[i+1]+y[i+1],i+1);	
	}
	REP(i,SIZE){
		sort(ALL(xs[i]));
		sort(ALL(ys[i]));	
	}
	int dist=mdist(A,B);
	uf.unite(A,B);
	for(auto it=mpx.begin();it!=mpx.end();++it){
		if(mpx.count((*it).first+dist)){
			inpile(xs[mpx[(*it).first]],xs[mpx[(*it).first+dist]],dist-1);
		}
	}
	for(auto it=mpy.begin();it!=mpy.end();++it){
		if(mpy.count((*it).first+dist)){
			inpile(ys[mpy[(*it).first]],ys[mpy[(*it).first+dist]],dist);
		}
	}
	LL answer=0;
	FOR(i,1,N+1){
		if(uf.find(i)==uf.find(A)){
			answer+=ans[i];
		}
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 22016
const log = console.log;

const replaceStringAt = (
  str: string,
  index: number,
  length: number,
  replaceValue: string
) => str.substr(0, index) + replaceValue + str.substr(index + length);

// ----

function Main(input: string): void {
  log(replaceStringAt(input, 3, 1, "8"));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#python setは中身の重複がないように要素を管理する.
#n = int(input())
#input関数は入力されたデータを文字列として扱います
#int(input())により, 入力を数値へ変換する.
#setに対して ^ 演算子は XORの働きを持つ.
#len()は, リストをはじめコンテナ型オブジェクトのサイズの取得に使用される関数である

n = int(input())
s = set()

for i in range(n):
  s ^= {input()}

print(len(s))



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

int main() {
  string a;
  cin >>a;
  if(a == "A"){
    cout<<"T";
  }
  else if(a == "T"){
    cout <<"A";
  }
  else if(a == "C"){
    cout <<"G";
  }
  else if(a =="G"){
    cout <<"C";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (i&1) {
            if (s[i] == 'R') {
                cout << "No" << endl;
                return;
            }
        } else {
            if (s[i] == 'L') {
                cout << "No" << endl;
                return;
            }
        }
    }
    cout << "Yes" << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  string n;
  cin >> n;
  if (n[0] == n[1] && n[1] == n[2]) cout << "Yes" << endl;
  else if (n[1] == n[2] && n[2] == n[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
a,b,c,d = map(int,raw_input().split())
x = max(a,c)-min(a,c)
if d >= x :
	print('Yes')
elif (max(a,b)-min(a,b)) <= d and (max(b,c)-min(b,c)) <= d :
	print('Yes')
else:
	print('No')

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

int main()
{
  int n;
  cin >> n;
  valarray<int> x(n);
  for (auto&& e : x) cin >> e;
  int m = round(double(x.sum()) / n);
  cout << pow(x - m, 2).sum() << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
bitset<5100>kk;
int num[5100];
int n,k;
int main() { 
	scanf("%d%d",&n,&k);
	int sum=0;
	for(int i=1;i<=n;++i) { 
		scanf("%d",&num[i]);
		num[i]=min(num[i],k);
		sum+=num[i];
	} 
	sort(num+1,num+n+1);
	kk[0]=1;
	for(int i=n;i>=1;--i) { 
		bool ret=1;
		for(int j=k-1;j>=k-sum&&j>=0;--j) { 
			if(kk[j]==1) { 
				ret=0;break;
			} 
		}
		if(ret==1) { 
			printf("%d\n",i);
			return 0;
		}
		kk|=(kk<<num[i]);
		sum-=num[i];
	} 
	printf("0\n");
	return 0;
} 


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    K = int(input())
    A, B = map(int, input().split())

    result = "NG"
    for i in range(A, B + 1):
        if i % K == 0:
            result = "OK"
    print(result)


if __name__ == "__main__":
    main()


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


int main() {
    int N;
    cin>>N;
    int a[N];
    rep(i,N)cin>>a[i];
    int count=0;
    int c=1;

        for(int j=0;j<N;j++){
            if(a[j]==c){
                c++;
        }
        else count++;
        }
    if(c==1)cout<<"-1"<<endl;
   else cout<<count<<endl;
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a, b;
  cin >> a >> b;
  int now = 0;
  int counter = 0;
  for (int i = 0; i < a; i++){
    if (now <= b){
      counter++;
    }
    int c;
    cin >> c;
    now += c;
  }
  
  if (now <= b){
    counter++;
  }
  
  cout << counter;
}

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

int main(int argc, char *argv[]){
  int N;
  cin>>N;
  vector<long long> A(N,0);
  for(int i=0;i<N; i++){
    long long a;
    cin>>a;
    A[i]=a;
  }
  vector<long long> S(N+1,0);
  for(int i=0; i<N; i++) S[i+1]=A[i]+S[i];
  
  long long min=100000000000000;
  for(int i=1; i<N; i++){
    long long diff;
    diff=abs(S[i]-(S[N]-S[i]));
    if(diff<min){
      min=diff;
    }
  }
  cout<<min<<endl;
}


Measured memory_bytes: 3328
/*
[abc126] A - Changing a Character
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int N, K;
string S;

string solve() {
    S[K - 1] += 'a' - 'A';
    return S;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int a[26],b[4];

int main()
{
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			char t;
			cin >> t;
			a[t - 'a']++;
		}
	}

	for (int i = 0; i < 26; i++)
		b[a[i] % 4]++;

	b[1] += b[3];
	b[2] += b[3];

	bool flag;
	if (h % 2 == 1 && w % 2 == 1)
	{
		flag = b[1] == 1 && 2*b[2] <= h + w - 2;
	}
	else if (h % 2 == 1 && w % 2 == 0)
	{
		flag = b[1] == 0 && 2 * b[2] <= w;
	}
	else if (h % 2 == 0 && w % 2 == 1)
	{
		flag = b[1] == 0 && 2 * b[2] <= h;
	}
	else if (h % 2 == 0 && w % 2 == 0)
	{
		flag = b[1] == 0 && b[2] == 0;
	}
	if (flag)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define foreach(a,A) for(auto &a:A)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll n, k; cin >> n >> k;
    vector<ll> base(n);
    rep(i, n){
        ll a; cin >> a;
        a --;
        base[i] = a;
    }

    ll res = 0;
    while(k){
        if(k & 1){
            res = base[res];
        }
        vector<ll> next(n);
        rep(i, n){
            next[i] = base[base[i]];
        }
        swap(base, next);
        k >>= 1;
    }
    cout << res + 1 << endl;
}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

const int MOD = 1000000007;

int n;
Msi memo[101];

bool OK(string last4){
    REP(i,4){
        string tmp = last4;
        if(i>=1){
            tmp[i-1] = last4[i];
            tmp[i] = last4[i-1];
        }
        if(tmp.find("AGC") != string::npos){
            return false;
        }
    }
    return true;
}

string acgt = "ACGT";
int DFS(LL cur, string last3){
    if(memo[cur].count(last3) == 1) return memo[cur][last3];
    if(cur == n) return 1;
    int ret = 0;
    REP(i,4){
        if(OK(last3+acgt[i])){
            ret = (ret + DFS(cur+1, last3.substr(1) + acgt[i])) % MOD;
        }
    }
    memo[cur][last3] = ret;
    return ret;
}


int main(){
    cin>>n;

    cout<<DFS(0, "TTT")<<endl;

    return 0;
}

Measured memory_bytes: 896
N,x=map(int,input().split())
a=[int(x) for x in input().split()]
a.sort()
count=0
if sum(a)==x:
  count=N
elif sum(a)<x:
  count=N-1
else:
  for i in range(N):
    if sum(a[:i])<=x and sum(a[:i+1])>x:
      count=i
print(count)

Measured memory_bytes: 9032
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);        

        int N = sc.nextInt();
        int X[] = new int[N];

        for(int i=0; i<N; i++){
            X[i] = sc.nextInt();
        }
        
        List<Integer> max_list = new ArrayList<>();
        int max = 0;
        
        for(int i=1; i<=100; i++){
            for(int j=0; j<N; j++){
                max+= Math.abs((i-X[j])*(i-X[j]));
            }
            max_list.add(max);
            max =0;
        }
        Optional<Integer> min = max_list.stream().min((a, b) -> a.compareTo(b));
        System.out.println(min.get());
    }
}

Measured memory_bytes: 27092