akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

    private static final String ZERO = "0";

    private enum Direction {
        W, E;
    }

    public static String process(TestCase testCase) {
        final int N = testCase.N;
        final String S = testCase.S;

        if (N <= 0) {
            return ZERO;
        } else {
            final List<Direction> directions = Arrays.stream(S.split(""))
                    .map(Direction::valueOf)
                    .collect(Collectors.toList());

            long min = IntStream.range(1, N)
                    .mapToObj(directions::get)
                    .filter(Direction.E::equals)
                    .count();

            long change = min;
            for (int i = 1; i < N; ++i) {
                final Direction prev = directions.get(i - 1);
                final Direction curr = directions.get(i);
                if (Direction.W.equals(prev)) {
                    change++;
                }
                if (Direction.E.equals(curr)) {
                    change--;
                }
                min = Math.min(min, change);
            }

            return String.valueOf(min);
        }
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final String result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String S = sc.next();

        return new TestCase(N, S);
    }

    private static void output(String result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final String S;

        public TestCase(int N, String S) {
            this.N = N;
            this.S = S;
        }
    }
}


Measured memory_bytes: 52856
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string S;
	cin >> S;
	if (S == "ABC") {
		cout << "ARC" << endl;
	} else {
		cout << "ABC" << endl;
	}
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
  int k,x;
  cin >> k >> x;
  if(500*k>=x){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

#define SENTINEL 1000000000

int count=0;

void mergeSort(int A[],int left,int right){
  int i,mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  int *L,*R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));
  for(i=0;i<=n1-1;i++){
    L[i]=A[left+i];
  }
  for(j=0;j<=n2-1;j++){
    R[j]=A[mid+j];
  }
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
   if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}



  
  
int main(){
  int n,m,a[100005],b[100005];
  int i,j,k;
  int tmp,tmp2;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d %d",&a[i],&b[i]);
  }
  mergeSort(a,0,m);
  mergeSort(b,0,m);
  if(b[0]>=a[m-1])k=b[0]-a[m-1]+1;
  else k=0;
  printf("%d",k);
  return 0;
}
  


Measured memory_bytes: 1424
#include <cstdio>
#include <map>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, n)
int a[81], k, p, q, d;
int main()
{
    while (scanf("%d%d", &p, &q) == 2) {
        d = 0;
        a[0] = 0;
        std::map<int, int> m;
        m[p%q] = -1;
        p = p % q * 10;
        rep(i, 81) {
            int n = p / q;
            int r = p % q;
            a[i] = n;
            if (r == 0) { d = 1; break; }
            if (m.find(r) == m.end()) m[r] = i;
            else { k = m[r]; break; }
            p = p % q * 10;
        }
        rep(i, m.size()) printf("%d", a[i]); puts("");
        if (!d) {
            rep(i, k+1) putchar(' ');
            REP(i, k+1, m.size()) putchar('^');
            puts("");
        }
    }
    return 0;
}

Measured memory_bytes: 0
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
#include <bits/stdc++.h>
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int LL
#define zero 0LL
using namespace std;
template<typename T> inline void maximize(T &a,T b){a=max(a,b);}
template<typename T> inline void minimize(T &a,T b){a=min(a,b);}
template<typename T> inline bool middle(T a,T b,T c){return b<=a && a<=c;}
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
inline void outputVI(VI x){REP(i,SI(x)){cout << three(i," ","") << x[i];}OUT("");}
const int SIZE1=1e6+1000;
const int SIZE2=5010;
const int SIZE3=400;
const int SIZE=SIZE1;
const LL p=7+1e9;
const LL INF=1LL<<60;
const long double EPS=1e-7;
string s;
ut N,M,K,X,L,Y;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE],nums[SIZE],maps[SIZE2][SIZE2],answer=zero;
 
////////////////////////////////////////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////////////
void init(){
 	
}
LL solve(){
	LL H;
	cin >> N >> H;
	VI v(N);
	int maxim=0,a,b;
	REP(i,N){
		cin >> a >> b;
		v.PB(b);
		maximize(maxim,a);
	}
	sort(ALL(v),greater<LL>());
	int ans=0;
	REP(i,N){
		if(v[i]>=maxim and H>0){
			H-=v[i];
			ans++;
		}
	}
	if(H<=0) return ans;
	return ans+(H+maxim-1)/maxim;
}
signed main(){
	OUT(solve());
	return 0;
}

Measured memory_bytes: 26112
#include<bits/stdc++.h>
#define DBG(x) cerr << #x << “ = ” << (x) << endl
#define Rep(i,a,b) for (int i = a, to = b; i < to; i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

typedef long long Long;

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	int arr[5];
    Rep(i,0,5){
        cin>>arr[i];
        if(arr[i]==0){
            cout<<i+1;
        }
    } 
	return 0;
}

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

typedef long long ll;

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

    int n,x;
    cin >> n >> x;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    ll ans = 0;
    for(int i=0;i<n;i++){
        if(i==0){
            ans += max(a[i]-x,0);
            a[i] -= ans;
        }else{
            ans += max(a[i]-(x-a[i-1]),0);
            a[i] = min(x-a[i-1],a[i]);
        }
    }
    //for(int i=0;i<n;i++) cout << a[i] << endl;
    cout << ans << endl;
    return 0;
}

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

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


Measured memory_bytes: 3092
def hamming(s,t):
    d = 0
    for i in range(len(s)):
        if s[i]!=t[i]:
            d+=1
    return d

def main():
    s = input()
    t = input()

    candidates = []
    for i in range(len(s)-len(t)+1):
        candidates.append(hamming(t,s[i:i+len(t)]))

    print(min(candidates))
if __name__ == "__main__":
    main()

Measured memory_bytes: 9052
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(usize);
    let mut l1 = 2_u64;
    let mut l2 = 1_u64;
    for _ in 0..n-1 {
        let l3 = l2;
        l2 = l1 + l2;
        l1 = l3;
    }
    println!("{}", l2);
}

Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char A[100000];
    int n,s=0,i;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> A[i];
    }
    for(i=0;i<n;i++)
    {
        if(A[i]=='A'&&A[i+1]=='B'&&A[i+2]=='C')
        {
            s++;
        }
    }
    cout << s <<endl;

    return 0;
}


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

int main(){
    ll N, K; cin >> N >> K;
    vector<ll> a(N);
    for (ll i = 0; i < N; i++){
        ll x; cin >> x;
        x--;
        a[i] = x;
    } 

    vector<ll> line;
    set<ll> s;
    ll pos = 0;
    for (ll i = 0; i < K; i++)
    {
        if(s.count(pos)!=0) break;
        s.insert(pos);
        line.push_back(pos);
        pos = a[pos];
        if(i==K-1){
            cout << pos + 1 << endl;
            return 0;
        }
    }
    
    ll loop_start;
    for (ll i = 0, n=line.size(); i < n; i++)
    {
        if(pos==line[i]){
            loop_start = i;
            break;
        } 
    }

    //for(ll i: line) cout << i << " ";
    //cout << endl;
    //cout << loop_start << endl;

    K -= line.size();
    //cout << K << endl;
    K %= (line.size()-loop_start);
    //cout << K << endl;
    cout << line[loop_start+K] + 1 << endl;
}

Measured memory_bytes: 13484
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	int n;cin>>n;
	int a[n+1];
	int pos[n+1];
	map<int,int> m;
	fo1(i,n){
		cin>>a[i];
		m[a[i]]=i;
	}
	fo1(i,n){
		cout<<m[i]<<" ";
	}
}

int32_t main()
{
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

Measured memory_bytes: 7936
#include<stdio.h>
int main(void)
{
	int a,b,c,d,t,ao;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	t=a;
	ao=c;
	while(1){
		ao=ao-b;
		if(t<=0){
			printf("No\n");
		break;
		}
		t=t-d;
		if(ao<=0){
			printf("Yes\n");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var inputList = Console.ReadLine().Split(' ');
			var n = inputList[0];

			var valueList = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToList();
			var hashSet = new HashSet<int>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

			foreach (var value in valueList)
			{
				if (hashSet.Contains(value))
				{
					hashSet.Remove(value);
				}
			}

			var tmp = int.Parse(n);

			while(true)
			{
				var tmpString = tmp.ToString();
				if(tmpString.All(c => hashSet.Contains(int.Parse(c.ToString()))))
				{
					break;
				}
				tmp++;
			}


			Console.WriteLine(tmp);
		}
	}
}


Measured memory_bytes: 15456
#include<bits/stdc++.h>
using namespace std;
int N;
string S;
main(){
  cin>>N>>S;
  vector<int>scores;
  for(int i_cut=1;i_cut<N;++i_cut){
    const string X=S.substr(0,i_cut);
    const string Y=S.substr(i_cut,N-i_cut);
    vector<bool> X_exist(256);
    for(int i=0;i<X.size();++i){
      X_exist[X[i]]=true;
    }
    vector<bool> Y_exist(256);
    for(int i=0;i<Y.size();++i){
      Y_exist[Y[i]]=true;
    }
    vector<bool> XY_exist(256);
    for(int i=0;i<XY_exist.size();++i){
      XY_exist[i]=X_exist[i]&&Y_exist[i];
    }
    vector<int> XY_sum(XY_exist.begin(),XY_exist.end());
    for(int i=1;i<XY_sum.size();++i)XY_sum[i]+=XY_sum[i-1];
    const int score=XY_sum.back();
    scores.push_back(score);
  }
  cout<<*max_element(scores.begin(),scores.end())<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    char[] c = s.toCharArray();
    int[] W = new int[n+1];
    int[] E = new int[n+1];

    for (int i = 0; i < n; i++) {
      if (i >= 1) W[i+1] = W[i];
      if (c[i] == 'W') W[i+1]++;
    }

    for (int i = 0; i < n; i++) {
      if (i >= 1) E[i+1] = E[i];
      if (c[i] == 'E') E[i+1]++;
    }

    int min = 300000;

    for (int i = 0; i < n; i++) {
      int gap = W[i]+(E[n]-E[i+1]);
      min = Math.min(min,gap);
    }

    System.out.println(min);

  }

}


Measured memory_bytes: 32576
/**
 * Binary search trees - Binary Search Tree II
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		Tree tree = new Tree();
		int key;

		int n = parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			line = br.readLine();
			switch (line.charAt(0)) {
				case 'i':
					key = parseInt(line.substring(line.indexOf(' ') + 1));
					tree.insert(new Node(key));
					break;
				case 'f':
					key = parseInt(line.substring(line.indexOf(' ') + 1));
					if (tree.find(key) != null) System.out.println("yes");
					else System.out.println("no");
					break;
				case 'p':
					tree.print(Tree.Order.Inorder);
					tree.print(Tree.Order.Preorder);
					break;
			}
		}
	} //end main
}

class Tree {

	enum Order {
		Preorder,
		Inorder,
		Postorder
	}

	Node root;

	Node insert(Node node) {
		Node parent = null;
		Node child = root;
		//
		while (child != null) {
			parent = child;
			if (node.key < child.key) child = child.left;
			else child = child.right;
		}
		node.parent = parent;
		//
		if (parent == null) {
			this.root = node;
		} else if (node.key < parent.key) {
			parent.left = node;
		} else {
			parent.right = node;
		}
		return node;
	}

	Node find(int key) {
		Node node = root;
		while (node != null && key != node.key) {
			if (key < node.key) node = node.left;
			else node = node.right;
		}
		return node;
	}

	void print(Order order) {
		switch (order) {
			case Preorder:
				walkPreorder(root);
				break;
			case Inorder:
				walkInorder(root);
				break;
			case Postorder:
				walkPostorder(root);
				break;
		}
		System.out.println();
	}

	void walkPreorder(Node node) {
		if (node == null) return;
		System.out.print(" " + node.key);
		walkPreorder(node.left);
		walkPreorder(node.right);
	}

	void walkInorder(Node node) {
		if (node == null) return;
		walkInorder(node.left);
		System.out.print(" " + node.key);
		walkInorder(node.right);
	}

	void walkPostorder(Node node) {
		if (node == null) return;
		walkPostorder(node.left);
		walkPostorder(node.right);
		System.out.print(" " + node.key);
	}
}

class Node {
	int key;
	Node parent, left, right;

	Node(int key) {
		this.key = key;
	}
}

Measured memory_bytes: 126832
# -*- coding: utf-8 -*-

#----------
A,B,C,D = [ int(s) for s in list(input().strip()) ]
#----------

def check(A,B,C,D):
    for i in [-1,1]:
        for j in [-1,1]:
            for k in [-1,1]:
                sum = A + (-1)*i*B + (-1)*j*C + (-1)*k*D
                
                if sum == 7:
                    return A,(-1)*i*B,(-1)*j*C,(-1)*k*D

a,b,c,d = check(A,B,C,D)
print('{}{:+}{:+}{:+}=7'.format(a,b,c,d))


Measured memory_bytes: 3064
until (n = $<.gets.to_i).zero?
  field = Array.new(n) {$<.gets.chomp}
  field.map! {|st| eval("0b" + st.gsub(/\./, "0").gsub(/\*/, "1"))}
  max = 0
  
  n.times do |y|
    l = field[y]
    break unless n - y > max
    (n - y).times do |i|
      l |= field[y + i]
      if l.to_s(2).rjust(n, "0").include?("0" * (i + 1))
        max = i + 1 if i + 1 > max
      end
    end
  end
  puts max
end


Measured memory_bytes: 14948
#include <iostream>
#include <vector>
#include <tuple>
#include <array>

using namespace std;

int main()
{
    uint n;
    cin >> n;
    while(n--){
        uint y, m, d;
        cin >> y >> m >> d;
        int cnt = 0;
        while(!(y == 1000 && m == 1 && d == 1)){
            ++d;
            if(y % 3 == 0 && d == 21){
                ++m;
                d = 1;
            }else if(y % 3 != 0 && (m & 1) == 0 && d == 20){
                ++m;
                d = 1;
            }else if(y % 3 != 0 && d == 21){
                ++m;
                d = 1;
            }

            if(m == 11){
                ++y;
                m = 1;
            }

            ++cnt;
        }

        cout << cnt << endl;
    }

    return  0;
}

Measured memory_bytes: 1156
using System;
using System.Linq;

namespace _176_a
{
    internal class Takoyaki
    {
        private static void Main(string[] args)
        {
            var nxt = Console.ReadLine()?.Split(" ").Select(int.Parse).ToArray();
            if (nxt == null) return;

            var n = nxt[0];
            var x = nxt[1];
            var t = nxt[2];

            if (n % x == 0)
            {
                Console.WriteLine(n / x * t);
            }
            else
            {
                Console.WriteLine((n / x + 1) * t);
            }
        }
    }
}

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

int main() {
	int ans=0;
	int a, b;
	cin >> a >> b;
	for (int i = a; i <= b; i++) {
		int num = i;
		int array[10];
		bool flag = 1;
		int count = 0;
		while (num >= 1) {
			array[count] = num % 10;
			count++;
			num = num / 10;
		}
		for (int j = 0; j < count / 2; j++) {
			if(array[j]!=array[count-1-j]){
				flag=0;
				break;
			}

		}
		if(flag){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#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 <>())
#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<ll,ll> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;



int main(){
    int n,W;
    cin >> n >> W;
    vector<int> w(n);
    vector<ll> v(n);
    rep(i,n) cin >> w[i] >> v[i];
    
    vector<vector<ll>> dp(n,vector<ll>(W*2,0LL));
    rep(i,W){
        dp[0][w[0]+i] = v[0];
    }
    rep(i,n-1){
        rep(oldW,W+1){
            dp[i+1][oldW] = max(dp[i+1][oldW],dp[i][oldW]);
        }
        rep(oldW,W+1){
            int newW = oldW + w[i+1];
            dp[i+1][newW] = max(dp[i+1][newW],dp[i][oldW] + v[i+1]);
        }
    }
    cout << dp[n-1][W];
    
}


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

int main() {
    int n; cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s.at(i);
    int ac , wa, tle , re;
    ac = 0; wa = 0; tle = 0; re = 0;
    rep(i, n){
        if ("AC" == s.at(i)) ac++;
        else if ("WA" == s.at(i)) wa++;
        else if ("TLE" == s.at(i)) tle++;
        else re++;
    }

    cout << "AC x "<< ac << endl;
    cout << "WA x "<< wa << endl;
    cout << "TLE x "<< tle << endl;
    cout << "RE x " << re << endl; 
}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=-mod;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(H);lin(W);lin(N);vlin(a,N);
  
  vector<vector<ll>>c(H,vector<ll>(W));
  
  ll k=0;
  
  rep(i,H){
    if(i%2==0){
      for(int j=0;j<W;j++){
        c[i][j]=k+1;
        a[k]--;
        if(a[k]==0){
          k++;
        }
      }
    }
    else{
      for(int j=W-1;j>=0;j--){
        c[i][j]=k+1;
        a[k]--;
        if(a[k]==0){
          k++;
        }
      }
    }
  }
  
  rep(i,H){
    rep(j,W){
      cout<<c[i][j]<<" ";
    }
    cout<<endl;
  }
  
}

Measured memory_bytes: 512
let s = read_line () in
let n = String.length s in

let m = 1_000_000_000 + 7 in
let ( *@) a b = ((a mod m) * (b mod m)) mod m in
let ( +@) a b = (a + b) mod m in
let dp = Array.make_matrix (n + 1) 4 0 in
let () =
    let m1 i = if s.[i] = '?' then 3 else 1 in
    let m2 i j = if s.[i] = '?' || s.[i] = "ABC".[j] then 1 else 0 in
    dp.(n).(3) <- 1;
    for i = n - 1 downto 0 do
        dp.(i).(3) <- dp.(i + 1).(3) *@ m1 i
    done;
    for j = 2 downto 0 do
        for i = n - 1 downto 0 do
            dp.(i).(j) <- m1 i *@ dp.(i + 1).(j) +@ m2 i j *@ dp.(i + 1).(j + 1)
        done
    done;
    Printf.printf "%d\n" dp.(0).(0)
in
()

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

typedef long long i64;

int v[200010];

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

    for (int i = 1; i <= n; i++)
        cin >> v[i];

    i64 ans = 0;

    for (int i = 1, dr = 0, nract = 0; i <= n; i++) {
        while (dr + 1 <= n && (nract & v[dr + 1]) == 0)
            nract |= v[dr + 1], dr++;
        ans += dr - i + 1;
        nract ^= v[i];
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;

using namespace std;
int main(){
    while(1){
        int T,D,L;
        cin >> T >> D >> L;
        if(T==0 && D==0 && L==0){
            break;
        }
        
        int last=-D;
        int ans=0;
        for(int t=1; t<=T; t++){
            int x;
            cin >> x;
            
            if(t<=last+D){
                ans++;
            }
            
            if(x>=L){
                last=t;
            }
        }
        
        cout<<ans<<endl;
    }
    return 0;
}






Measured memory_bytes: 3096
#include <iostream>
#include <set>
#define endl '\n'

using namespace std;

int main() {
  set<string> s;

  int n = 0;
  cin >> n;

  string temp;

  for (int i = 0; i < n; i++) {
    cin >> temp;
    s.insert(temp);
  }

  cout << s.size();

  return 0;
}

Measured memory_bytes: 15616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 int a = sc.nextInt();
		 int b = sc.nextInt();


		 if((a * b) % 2 == 0) {
			 System.out.print("Even");
		 }else {
			 System.out.print("Odd");

		 }

	}

}


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

int main(){
   int n,a;
   int data[100];
   cin >> n;

   for(int i=0; i<n; i++){
      cin >> a;
      data[i] = a;
   }
   printf("%d",data[n-1]);
   for(int i=2; i<=n; i++){
      printf(" %d",data[n-i]);
   }
   printf("\n");


   return 0;
}



Measured memory_bytes: 3172
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　| 　_　 _ l
　 　　　／` ミ＿xノ
　　 　 /　　　 　 |　
　　　 /　 ヽ　　 ﾉ　　
　 　 │　　|　|　|　　
　／￣|　　 |　|　|
　| (￣ヽ＿_ヽ_)__)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1001001001;

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n);
  vector<int> b(n);
  rep(i, n) cin >> a[i] >> b[i];
  vector<int> dp(h + 1, INF);
  dp[0] = 0;

  rep(i, h + 1) {
    rep(j, n) {
      if (i >= a[j]) {
        dp[i] = min(dp[i], dp[i - a[j]] + b[j]);
      } else {
        dp[i] = min(dp[i], dp[0] + b[j]);
      }
    }
  }

  cout << dp[h] << endl;
}

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

double a, b, x;

bool equal(double x, double y){
	return abs(x-y) < 0.000000000001;
}

double cal(double sita){
	if(b*tan(M_PI/2 - sita) > a){
		return a*a*b - (a*a*a/2*tan(sita));
	}else{
		return a*b*b/2*tan(M_PI/2 - sita);
	}
}

int main(){
	cin >> a >> b >> x;

	double mini = 0;
	double maxi = M_PI/2;

	while(!equal(mini, maxi)){
		double mid = (mini + maxi)/2;
		double vol = cal(mid);
		
		if(vol > x){
			mini = mid;
		}else{
			maxi = mid;
		}
	}
	printf("%.10f\n", 180 *(mini/M_PI));
}

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

using namespace std;

#define int long long
#define rep(i,x) for(int i=0;i<x;++i)

const int inf = 1e9;

signed main()
{
    int N;

    while (cin >> N, N) {
        vector<int> hp(N);

        rep(i, N) {
            cin >> hp[i];
        }

        int M;

        cin >> M;

        vector<pair<int,int>> S, A;

        rep(i, M) {
            string s;
            int mp, dmg;
            cin >> s >> mp >> s >> dmg;
            if (dmg == 0) continue;
            if (s == "Single") S.push_back(make_pair(mp, dmg));
            else A.push_back(make_pair(mp, dmg));
        }

        vector<int> dp1(100010, inf), dp2(100010, inf);
        dp1[0] = dp2[0] = 0;

        for (int i = 0; i < S.size(); ++i) {
            int mp = S[i].first, dmg = S[i].second;
            for (int j = 0; j <= 100000; ++j) {
                if (j - dmg >= 0) {
                    dp1[j] = min(dp1[j], dp1[j - dmg] + mp);
                } else {
                    dp1[j] = min(dp1[j], mp);
                }
            }
        }

        for (int i = 100001; i >= 1; --i) dp1[i - 1] = min(dp1[i - 1], dp1[i]);

        for (int i = 0; i < A.size(); ++i) {
            int mp = A[i].first, dmg = A[i].second;
            for (int j = 0; j <= 100000; ++j) {
                if (j - dmg >= 0) {
                    dp2[j] = min(dp2[j], dp2[j - dmg] + mp);
                } else {
                    dp2[j] = min(dp2[j], mp);
                }
            }
        }

        for (int i = 100001; i >= 1; --i) dp2[i - 1] = min(dp2[i - 1], dp2[i]);

        int mi = inf;

        dp1[0] = dp2[0] = 0;

        for (int a = 0; a <= 100000; ++a) {
            int sum = dp2[a];

            for (int i = 0; i < N; ++i) {
                if (hp[i] - a >= 0) {
                    sum += dp1[hp[i] - a];
                }
            }

            mi = min(mi, sum);
        }

        cout << mi << endl;
    }
}

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

int *dp, *hrr, n, k;

int main(){
    cin>>n>>k;
    hrr = new int[n]; dp = new int[n];
    for(int i=0;i<n;i++){
        cin>>hrr[i];
    }

    dp[0] = 0;
    for(int i=1;i<k;i++){
        dp[i]=INT_MAX;
        for(int j=1;j<=i;j++){
            dp[i] = min(dp[i], dp[i-j]+abs(hrr[i]-hrr[i-j]));
        }
    }
    //dp[1] = abs(hrr[1]-hrr[0]) + dp[0];
    for(int i=k;i<n;i++){
        dp[i] = INT_MAX;
        for(int j=1;j<=k;j++){
            dp[i] = min(dp[i], dp[i-j]+abs(hrr[i]-hrr[i-j]));
        }
        //dp[i] = min(dp[i-1]+abs(hrr[i]-hrr[i-1]), dp[i-2]+abs(hrr[i]-hrr[i-2]));
    }

    
    cout << endl;

    int ans = dp[n-1];
    delete[] hrr;
    delete[] dp;
    cout << ans;

    return 0;
}

Measured memory_bytes: 3948
#include <stdio.h>

int main(void)
{
	int W,H;
	int x, y, r;
	int f;
	scanf("%d %d %d %d %d", &W, &H, &x,&y,&r);

	f = 0;
	if (x + r>W)f = 1;
	if (y + r>H)f = 1;
	if (r>x)f = 1;
	if (r>y)f = 1;

	if (f == 0)printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 584
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;

class Program
{
	static void Main(string[] args)
	{
		int X = int.Parse(Console.ReadLine());
		int i500 = X / 500;
		int nokori = X % 500;
		int i5 = nokori / 5;
		int ans = i500 * 1000 + i5 * 5;
		Console.WriteLine(ans);

	}
}

//string s = Console.ReadLine();
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];
//int N = int.Parse(Console.ReadLine());
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());
//Boolean ok = false;

//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.ReadKey();

//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];


Measured memory_bytes: 13140
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp std::make_pair
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::pair<int,pi> pipi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
const int NMAX=200010;
int N,K,L;
int p[100010],q[100010],r[100010],s[100010];
//UnionFindTreeのクラス。
/***************************/
class uft{
public:
  int par[NMAX];//親
  int rank[NMAX];//木の深さ
  int size[NMAX];//木の大きさ
  uft(int n);//コンストラクタ
  int find(int x);
  void unite(int x,int y);
  bool same(int x,int y);
  int usize(int x);
};
uft::uft(int n){//コンストラクタ uft uf(N)でサイズNのunionfindtreeを宣言 
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
    size[i]=1;
  }
}
int uft::find(int x){//xの根を返す
  if(par[x]==x) return x;//根の親は自分自身
  else return par[x]=find(par[x]);//再起で親を辿る
}
void uft::unite(int x,int y){//x,yを併合
  x=find(x);
  y=find(y);
  if(x==y) return ;//根が同じなら併合する必要なし

  if(rank[x]<rank[y]){//木の深い方に浅い方をつける
    par[x]=y;
    size[y]+=size[x];
  }
  else{
    par[y]=x;
    size[x]+=size[y];
    if(rank[x]==rank[y]) rank[x]++;//同じ深さなら深さを増やす
  }
}
bool uft::same(int x,int y){//x,yが同じグループにいるかどうかを返す
  return find(x)==find(y);//根が同じかどうかを判断する
}
int uft::usize(int x){//xの属する木のサイズを返す
  return size[find(x)];
}

int main(){
  cin>>N>>K>>L;
  rep(i,K){
    cin>>p[i]>>q[i];
    p[i]--;q[i]--;
  }
  rep(i,L){
    cin>>r[i]>>s[i];
    r[i]--;s[i]--;
  }
  uft ur(N),ut(N);
  rep(i,K){
    ur.unite(p[i],q[i]);
  }
  rep(i,L){
    ut.unite(r[i],s[i]);
  }
  pipi p[200010];
  rep(i,N){
    p[i]=mp(ur.find(i),mp(ut.find(i),i));
  }
  std::sort(p,p+N);
  int res[200010];
  int cnt=1;
  rep(i,N-1){
    if(p[i].first==p[i+1].first&&p[i].second.first==p[i+1].second.first) cnt++;
    else{
      rep(j,cnt){
	res[p[i-j].second.second]=cnt;
      }
      cnt=1;
    }
  }
  rep(j,cnt){
    res[p[N-1-j].second.second]=cnt;
  }
  rep(i,N){
    std::cout<<res[i]<<" ";
  }
  std::cout<<"\n";
  
  return 0;
}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
template<typename T>void read(T &x){
	x = 0; int f(1); char c = getchar();
	for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
	for(;isdigit(c);c = getchar()) x = (x<<3)+(x<<1)+c-'0';
	x *= f;
}
const int maxn = 200005;
int n,a[maxn];
int main(){
	read(n); int sum = 0;
	for(int i(1);i <= n;++i){
		char C = getchar();
		while(C != 'R'&&C != 'W')	C = getchar();
		if(C == 'R')	a[i] = 1;
		sum += a[i];
	} int ans = 0;
	for(int i(1);i <= sum;++i)
		if(!a[i])	ans += 1;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4540
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
for l in range(min(n, k) + 1):
    for r in range(min(n, k) - l + 1):
        bag = sorted(v[:l] + v[n - r:])
        minus = sum(vi for vi in bag[:k - l - r] if vi < 0)
        ans = max(ans, sum(bag) - minus)
print(ans)


Measured memory_bytes: 74160
#include<cstdio>
#include<algorithm>
using namespace std;
int dp[100005][5],a[5],n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
		{
			scanf("%d",&a[j]);
			for(int k=1;k<=3;k++)
			{
				if(j!=k) dp[i][j]=max(dp[i][j],dp[i-1][k]+a[j]);
			}
		}
	}
	printf("%d\n",max(max(dp[n][1],dp[n][2]),dp[n][3]));
	return 0;
}

Measured memory_bytes: 2048
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int N;
    cin >> N;
    vector<int> a(3 * N);
    REP(i, 3 * N) cin >> a[i];
    sort(a.begin(), a.end());

    int num = 0;
    int ans = 0;
    for (int i = 3 * N - 2; i >= 0; i -= 2) {
        if (num == N) break;
        ans += a[i];
        num++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
typedef long long ll;
ll INF = 1LL << 60;

using namespace std;




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

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

using namespace std;

int main() {
    size_t n, k;
    cin >> n >> k;
    size_t c = 0;
    for (size_t i = 1; i <= n; ++i) {
        size_t h;
        cin >> h;
        if (h >= k)
            ++c;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int x;
		Scanner scan = new Scanner(System.in);
	    x = scan.nextInt();


	    //?????£????????????(int)
	    System.out.println( (int)Math.pow(x, 3) );
	    
	   

	}

}

Measured memory_bytes: 26128
#include<iostream>
#include<vector>
#include<list>
#define INF 2e9
using namespace std;

void Dikstra(const vector<vector<pair<int, int> > >& G, vector<int>& d){
    d[0] = 0;
    list<int> i_gray;
    i_gray.push_back(0);
    vector<bool> is_black(d.size(), false);
    is_black[0] = true;
    while (!i_gray.empty()) {
        list<int>::iterator min_it = i_gray.begin();
        for (list<int>::iterator it = i_gray.begin(); it != i_gray.end(); it++) {
            if (d[*it] < d[*min_it]) min_it = it;
        }
        is_black[*min_it] = true;
        for (int i = 0; i < G[*min_it].size(); i++) {
            int v = G[*min_it][i].first;
            int w = G[*min_it][i].second;
            if (!is_black[v] && d[*min_it] + w < d[v]) {
                if (d[v] == INF) i_gray.push_back(v);
                d[v] = d[*min_it] + w;
            }
        }
        i_gray.erase(min_it);
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<pair<int, int> > > G(n);
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            G[u].push_back(make_pair(v, c));
        }
    }
    vector<int> d(n, INF);
    Dikstra(G, d);
    for (int i = 0; i < n; i++) {
        cout << i << " " << d[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 7492
h , w = map(int,input().split())
p = [["." for i in range(w+2)]]
for i in range(h):
    kar = []
    kar.append(".")
    kar.extend(list(input()))
    kar.append(".")
    p.append(kar)
p.append(["." for i in range(w+2)])

for i in range(1,h+1):
    for j in range(1,w+1):
        if (p[i][j] == "#" and 
        p[i-1][j] == "." and 
        p[i+1][j] == "." and 
        p[i][j-1] == "." and
        p[i][j+1] == "."):
            print("No")
            exit()
print("Yes")

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

int main () {
  long long a, b, c;
  cin >> a >> b >> c;
  long long ans = b;
  if (c > a + b) {
    ans = ans + a + b + 1;  
  }
  else {
    ans = ans + c;  
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000
#define ll long long
using namespace std;
int main()
{
    int N;
    cin >> N;
    ll A[N];
    ll sum = 0;
    ll ans = 0;
    rep(i, N)
    {
        ll a = 0;
        cin >> a;
        A[i] = a * 2;
        sum += a;
    };
    rep(i, N)
    {
        if (sum - A[i] > 0)
        {
            sum -= A[i];
        }
        else
        {
            ans = min(sum, A[i] - sum);
            break;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1792
a=[]
sheet=[0]*9
for _ in range(3):
    a+=list(map(int,input().split())) 
n=int(input())

for _ in range(n):
    b=int(input())
    if b in a:
        c=a.index(b)
        sheet[c]=1
bingo=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
flg=0
for bb in bingo:
    if sheet[bb[0]]==1:
        if sheet[bb[1]]==1:
            if sheet[bb[2]]==1:
                flg=1
if flg==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cctype>
#include <map>
#include <cstring>
#include <typeinfo>
#define REP(i,n) for(int i = 0;i < n ;i++)
#define FOR(i,m,n) for(int i= m ;i<n;i++)
using namespace std;

int main(void){
  int n,k,x,y;
  int sum;
  cin >> n >> k >> x >> y;
  sum=k*x;
  if(n>k)cout << sum+((n-k)*y) << endl;
  else cout << n*x << endl;
  return 0;
}


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


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    result = 1
    count = -1
    for i in range(N):
        result = A[result - 1]
        if result == 2 and count < 0:
            count = (i + 1)
    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%lf",&n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%lf ",n)
#define dprin(n) printf("%lf\n",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

ll solve(ll x,ll y,ll z)
{
      return x*x+y*y+z*z+x*y+y*z+z*x;
}
int main()
{
     ll n;
     lscf(n);
     ll a[n+1]={0};
     for(ll i=1;i<=100;i++)
     {
        for(ll j=1;j<=100;j++)
        {
              for(ll k=1;k<=100;k++)
              if(solve(i,j,k)<=n)
              a[solve(i,j,k)]++;
        }
     }
     rep(i,1,n+1)
     lprin(a[i]);
}


Measured memory_bytes: 3800
fun main(args: Array<String>) {
    val n = readLine()!!.split(" ").map { it.toInt() }[0]
    val h = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    h[0] = h[0] - 1
    var flag = 0
    for (i in 1 until n){
        if (h[i] > h[i-1]){
            h[i] = h[i] - 1
        } else if (h[i] < h[i-1]){
            flag = 1
            break
        }
    }
    if (flag == 0){
        println("Yes")
    } else {
        println("No")
    }
}

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

int main() {
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<long long> p(A), q(B), r(C);
  for (int i = 0; i < A; i++) cin >> p.at(i);
  for (int i = 0; i < B; i++) cin >> q.at(i);
  for (int i = 0; i < C; i++) cin >> r.at(i);
  sort(p.begin(), p.end(), greater<long long>());
  sort(q.begin(), q.end(), greater<long long>());
  priority_queue<long long> pq;
  for (int i = 0; i < X; i++) pq.push(p.at(i));
  for (int i = 0; i < Y; i++) pq.push(q.at(i));
  for (int i = 0; i < C; i++) pq.push(r.at(i));
  long long ans = 0;
  for (int i = 0; i < X + Y; i++) {
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 8816
#include <stdio.h>
#include <string.h>

int main (void){
    char str[101];
    scanf("%s", str);
    int i;
    int val = 0;
    for(i = 0; i < strlen(str); i++){
        val ^= str[i];    }



    if(val) printf("No\n");
    else printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128