akhauriyash/Code-Regression huggingface dataset:
#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;

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());
//int randt(int l, int r){ return (rando() % (r - l + 1) + l); }

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e5 + 5;
int mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
ll infll = 1e18 + 7;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a[4]; cin >> a[1] >> a[2] >> a[3]; sort(a + 1, a + 4); if (a[1] == 5 && a[2] == 5 && a[3] == 7) cout << "YES"; else cout << "NO";
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 3668
#include <iostream>
#include <stack>
using namespace std;
static const int N=101;
static const int White=0;
static const int Gray=1;
static const int Black=2;

int M[N][N];
int d[N],nt[N],f[N],tt,color[N];
int n;
int next_v(int k){
  for(int i=nt[k];i<=n;i++){
    nt[k]=i+1;
    if(M[k][i]) return i;
  }
  return -1;
}
void dfs_visit(int r){
  stack<int> S;
  S.push(r);
  color[r]=Gray;
  d[r]=++tt;

  while(!S.empty()){
    int u=S.top();
    int v=next_v(u);
    if(v!=-1){
      if(color[v]==White){
        color[v]=Gray;
        d[v]=++tt;
        S.push(v);
      }
    }else{
      S.pop();
      color[u]=Black;
      f[u]=++tt;
    }
  }
}
void dfs(){
  tt=0;
  for(int i=1;i<=n;i++){
    if(color[i]== White)dfs_visit(i);
  }
  for(int i=1;i<=n;i++){
    cout<<i<<" "<<d[i]<<" "<<f[i]<<"\n";
  }
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    int u,k,v;
    cin>>u>>k;
    for(int j=0;j<k;j++){
      cin>>v;
      M[u][v]=1;
    }
  }
  dfs();
}



Measured memory_bytes: 3108
//Atcoder
import java.io.*;
import java.util.*;

public class Main {

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

	public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        String str = sc.nextLine();
        int len = str.length();
        int cnt1 = 0, cnt2 = 0;
        for(int i=0;i<len;i++) {
            char c = str.charAt(i);
            if(i % 2 == 0) {
                if(c == '0') cnt1++;
                else cnt2++;
            }
            else {
                if(c == '0') cnt2++;
                else cnt1++;
            }
        }

        pw.println(Math.min(cnt1, cnt2));
        pw.close();
    }
}


Measured memory_bytes: 25044
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); 
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}	
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}		    
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}	    	  	
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}		
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}	
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}	    	
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}	    	
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}				
    }
    
    /********* SOLUTION STARTS HERE ************/
    static ArrayList<Integer> ar[];
    static int n;
    static int dep1[],dep2[];
    static boolean vis[];
    private static void solve(FastScanner in, PrintWriter out){
        n = in.nextInt();
        int tak = in.nextInt()-1;
        int aok = in.nextInt()-1;
        int u,v;
        ar = new ArrayList[n];
        dep1 = new int[n];
        dep2 = new int[n];
        vis = new boolean[n];
        for(int i=0;i<n;i++) ar[i] = new ArrayList<Integer>();
        for(int i=0;i<n-1;i++){
            u = in.nextInt()-1;
            v = in.nextInt()-1;
            ar[u].add(v);
            ar[v].add(u);
        }
        dfs1(tak,0);
        Arrays.fill(vis,false);
        dfs2(aok,0);
        int ans = 0;
        for(int i=0;i<n;i++){
            if(dep1[i]<dep2[i]){
                ans = Math.max(ans,dep2[i]);
            }
        }
        out.println(ans-1);
    }
    static void dfs1(int s,int d){
        dep1[s] = d;
        vis[s] = true;
        for(int i:ar[s]){
            if(!vis[i]) dfs1(i,d+1);
        }
    }
    static void dfs2(int s,int d){
        dep2[s] = d;
        vis[s] = true;
        for(int i:ar[s]){
            if(!vis[i]) dfs2(i,d+1);
        }
    }
    /************* SOLUTION ENDS HERE **********/
}

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

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(i, c) ((c).find(i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)

//=========================

void run_test() {
	ll n; cin >> n;
    
    if (n == 1) {
		cout << 0 << endl;
		return;
	}

	ll ans = 0;

	for(int i = 2; i <= 1000010; i++) {
		if(n % i == 0) {
			int p = 0;
			while(n % i == 0) {
				n /= i;
				p++;
			}
			int k = 1;
			while(p >= k) {
				p -= k;
				ans++;
				k++;
			}
		}
	}
	if(n > 1) ans++;

	cout << ans << endl;
}

//=========================

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; run_test(); }
	//int t; cin >> t; while(t--) run_test();
	run_test();
	return 0;	
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
 cin.tie(0);
 ios::sync_with_stdio(false); 
  ll n,a,b,c,cnt=0;
  cin>>n>>a>>b;
  for(int i=0;i<n;i++){
    cin>>c; 
    if(c>=a&&c<b){
      cnt++;
    }
  }
  cout<<n-cnt<<endl; 
  return 0; 
}



Measured memory_bytes: 3612
using System;

	public class Class1
	{
		public static void Main()
		{   
		
				int n = int.Parse(Console.ReadLine());
				string dataSet=Console.ReadLine();
				string[] data=dataSet.Split();
				int[] m=new int[n];
				int mini;
				int max;
				long sum;
				for(int i=0;i<n;i++)
				{
					m[i]=int.Parse(data[i]);
				}
				mini=m[0];
				max=m[0];
				sum=m[0];
				for(int j =1;j<n;j++)
				{
					if(mini>m[j])
					{
						mini =m[j];
					}
					else if (max<m[j])
					{
						max=m[j];					
					}
					
					sum =sum+m[j];
				
				}
				Console.WriteLine("{0} {1} {2}",mini,max,sum);
				
		}
	}
			    
				
			
			
		
	

 

Measured memory_bytes: 9812
N,K = map(int,input().split())
h = list(map(int,input().split()))
h = sorted(h)

line = 0
bool1 = False
for i in range(N):
  if h[i] >= K:
    line = i
    bool1 = True
    break

if bool1:
  print(N-i)
else:
  print(0)

Measured memory_bytes: 18532
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
inline int read()
{
	int x=0,t=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=-1,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return x*t;
}
int n,K;
int W[2101][2101],B[2101][2101];
int g[2101][2101];
int Count(int x,int y)
{
	int X=x+K-1,Y=y+K-1;
	x=max(x,1);y=max(y,1);
	X=min(X,K+K);Y=min(Y,K+K);
	if(X<x||Y<y)return 0;
	int ret=B[X][Y]-B[X][y-1]-B[x-1][Y]+B[x-1][y-1];
	return ret;
}
int Count2(int x,int y)
{
	int X=x+K-1,Y=y+K-1;
	x=max(x,1);y=max(y,1);
	X=min(X,K+K);Y=min(Y,K+K);
	if(X<x||Y<y)return 0;
	int ret=W[X][Y]-W[X][y-1]-W[x-1][Y]+W[x-1][y-1];
	return ret;
}
int main()
{
	n=read();K=read();
	memset(g,-1,sizeof(g));
	for(int i=1;i<=n;++i)
	{
		int x=read()%(K+K),y=read()%(K+K);
		char ch[2];
		scanf("%s",ch);
		if(ch[0]=='B')B[x+1][y+1]+=1;else W[x+1][y+1]+=1;
	}
	for(int i=1;i<=K+K;++i)
		for(int j=1;j<=K+K;++j)
		{
			B[i][j]+=B[i-1][j]+B[i][j-1]-B[i-1][j-1];
			W[i][j]+=W[i-1][j]+W[i][j-1]-W[i-1][j-1];
		}
	int sum=B[K+K][K+K];
	int ans=0,KK=K+K;	
	for(int i=1;i<=K;++i)
		for(int j=1;j<=K;++j)
		{
			int tot=0;
			tot-=(Count(i,j)+Count(i+K,j+K)+Count(i-K,j+K)+Count(i+K,j-K)+Count(i-K,j-K));
			tot+=Count2(i,j)+Count2(i+K,j+K)+Count2(i-K,j+K)+Count2(i+K,j-K)+Count2(i-K,j-K);
			tot-=(Count(i+KK,j+KK)+Count(i-KK,j+KK)+Count(i+KK,j-KK)+Count(i-KK,j-KK));
			tot+=(Count2(i+KK,j+KK)+Count2(i-KK,j+KK)+Count2(i+KK,j-KK)+Count2(i-KK,j-KK));
			ans=max(ans,sum+tot);
		}
	sum=W[KK][KK];
	for(int i=1;i<=K;++i)
		for(int j=1;j<=K;++j)
		{
			int tot=0;
			tot+=(Count(i,j)+Count(i+K,j+K)+Count(i-K,j+K)+Count(i+K,j-K)+Count(i-K,j-K));
			tot-=Count2(i,j)+Count2(i+K,j+K)+Count2(i-K,j+K)+Count2(i+K,j-K)+Count2(i-K,j-K);
			tot+=(Count(i+KK,j+KK)+Count(i-KK,j+KK)+Count(i+KK,j-KK)+Count(i-KK,j-KK));
			tot-=(Count2(i+KK,j+KK)+Count2(i-KK,j+KK)+Count2(i+KK,j-KK)+Count2(i-KK,j-KK));
			ans=max(ans,sum+tot);
		}
	printf("%d\n",ans);
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for (auto& e : d) cin >> e;
    sort(begin(d), end(d));
    cout << unique(begin(d), end(d)) - begin(d) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<cstdlib>
#include<cmath>

using namespace std;
int n,a[50];
int solve(int i){
    if(i==1||i==0)return 1;
    return solve(i-1)+solve(i-2);
}
int main(){
    int nl;
    cin>>nl;
    for(int i=0; i<nl; i++){
        double xa,ya,ra,xb,yb,rb;
    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    double k=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
    double s=sqrt(k);
    
    if(ra+rb<s)cout<<0<<endl;
    else if(ra+rb>=s&&s>=abs(ra-rb))cout<<1<<endl;
    else if(ra-rb>s)cout<<2<<endl;
    else if(rb-ra>s)cout<<-2<<endl;
    }
    return 0;
}

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

int main(void){
    int len,n,i,hug=0;
    char kaibun[100];
    
    scanf("%100s",kaibun);
    
    len=strlen(kaibun);
    
    n=len;
    
    if (len%2==0) {
        for (i=0;i<len/2;i++) {
            if (kaibun[i]!=kaibun[n-1]) {
                hug++;
            }
            n--;
        }
    } else {
        for (i=0;i<(len-1)/2;i++) {
            if (kaibun[i]!=kaibun[n-1]){
                hug++;
            }
            n--;
        }
    }
    
    printf("%d\n",hug);
    
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int px[4],py[4];
	int x,y,i;
	scanf("%d",&px[0]);
	scanf("%d",&py[0]);
	scanf("%d",&px[1]);
	scanf("%d",&py[1]);

	px[3]=-py[1]+py[0]+px[0];
	py[3]=px[1]-px[0]+py[0];

	px[2]=py[0]-py[1]+px[1];
	py[2]=-px[0]+px[1]+py[1];
	printf("%d %d %d %d",px[2],py[2],px[3],py[3]);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
ll n,a,b,f[N],g=1,mod=1e9+7,fac[N],inv[N],size[N];
vector<int>v[N];
ll pows(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y&1)ans=ans*x%mod;
		x=x*x%mod; 
		y>>=1;
	}
	return ans;
}
void pre(ll x,ll fa)
{
	size[x]=1;
	for(int i=0;i<v[x].size();i++)
	{
		int h=v[x][i];
		if(h==fa)continue;
		pre(h,x);
		size[x]+=size[h];
	}
	g=g*size[x]%mod;
}
void dfs(ll x,ll fa)
{
	for(int i=0;i<v[x].size();i++)
	{
		int h=v[x][i];
		if(h==fa)continue;
		f[h]=f[x]*(n-size[h])%mod*pows(size[h],mod-2)%mod;
		dfs(h,x);		
	}
}
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	for(int i=1;i<n;i++)
	{
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	ll nl=1;
	for(int i=1;i<=n;i++)nl=nl*i%mod;
	pre(1,1);
	f[1]=g;
	dfs(1,1);
	for(int i=1;i<=n;i++)
	printf("%lld\n",nl*pows(f[i],mod-2)%mod);
}

Measured memory_bytes: 20212
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    string s, t;
    cin >> s >> t;
    
    int n = s.size();
    for (int i = 0; i < n; i++) {
        int flag = 1;
        for (int j = 0; j < n; j++) {
            if (s[j] != t[(j + i) % n]) {
                flag = 0;
                break;
            }
        }
        if (flag == 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3604
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		UINT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

struct edge
{
	ll from;
	ll to;
	ll cost;
};

bool edge_comp(const edge& e1, const edge& e2)
{
	return e1.cost < e2.cost;
}

////////////////////
// UnionFind
////////////////////
class UnionFind
{
public:
	vector<int> parent;
	vector<int> rank;

	UnionFind(int n)
	{
		Rep(i, n) {
			parent.push_back(i);
			rank.push_back(1);
		}
	}
	int root(int x)
	{
		if (parent[x] != x) parent[x] = root(parent[x]);
		return parent[x];
	}
	// is same union between x and y
	bool same(int x, int y)
	{
		return root(x) == root(y);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if (rx == ry) return;
		if (rank[rx] > rank[ry]) {
			parent[ry] = rx;
			rank[rx] += rank[ry];
		}
		if (rank[rx] <= rank[ry]) {
			parent[rx] = ry;
			rank[ry] += rank[rx];
		}
	}
};

////////////////////
// kruskal(最小全域木)
////////////////////
vector< edge > shortest_edges;
ll kruskal(vector<edge> & edges, ll V)	// edgesは辺の集合、Vは頂点数
{
	UnionFind uf(V);// Union-Findの初期化
	ll res = 0;

	sort(edges.begin(), edges.end(), edge_comp); // edge.costの小さい順

	for (int i = 0; i < edges.size(); i++)
	{
		edge e = edges[i];
		if (!uf.same(e.from, e.to)) {
			uf.unite(e.from, e.to);
			res += e.cost;

			// save
			shortest_edges.push_back(e);
		}
	}

	return res;	// 最小の重み
}

////////////////////
// 回文判定 O(N)
////////////////////
bool isPalindrome(string input_str)
{
	bool ret = true;
	ll i = 0;
	ll j = input_str.length() - 1;

	while (ret && i <= j) {
		ret = ret & (input_str[i] == input_str[j]);
		i++;
		j--;
	}
	return ret;
}

// 数学：		最大公約数、最小公倍数、素因数分解
// 探索：		貪欲法(全探索)、2分探索、ソート
//				BFS(幅優先探索)、DFS(深さ優先探索)
// データ構造：	スタック、キュー、deque
//				ハッシュ、map、リスト
// DP:			桁DP、ビットDP、メモ化再帰
// グラフ:		最短経路(ダイクストラ、ベルマンフォード、ワーシャルフロイト)
//				最小全域木(クラスカル法、プリム法、Union-Find)
//				三角不等式
// その他：		最大フロー、マッチング問題
//				セグメント木、RMQ、BIT、平方分割、しゃくとり法
// 
int main()
{
	string C1 = "";
	string C2 = "";
	string ret = "YES";

	cin >> C1 >> C2;
	ll len = C1.length();

	Rep( i, len) {
		if ( C1[i] != C2[len - i - 1] ) {
			ret = "NO";
			break;
		}
	}

	cout << ret << endl;

	return 0;
}





Measured memory_bytes: 256
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n,x,l[103];
	int d[103];
	int cnt = 0;
	scanf("%d%d",&n,&x);
	d[1] = 0;
	for (int i = 1; i <= n + 1; ++i)	scanf("%d",&l[i]);
	for (int i = 1; i <= n + 1; ++i)
	{
		if(i >= 2)	d[i] = d[i - 1] + l[i - 1];
		if(d[i] <= x)	++cnt;
		// printf("%d ", d[i]);
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int dp[16][3 + 2][3 + 2];

int main(void)
{
	int n;
	char s[2], e[2], t[2];
	int start;
	int end;
	int barn;
	int mot;
	
	while (1){
		scanf("%d", &n);
		if (n == 0) break;
		
		scanf("%s%s%s", s, e, t);
		
		for (int i = 0; i < 5; i++){
			for (int j = 0; j < 5; j++){
				for (int k = 0; k < 16; k++){
					if (i == 0 || i == 4 || j == 0 || j == 4){
						dp[k][i][j] = -1;
					}
					else {
						dp[k][i][j] = 0;
					}
				}
			}
		}
		
		start = s[0] - 'A';
		barn = t[0] - 'A';
		dp[0][(start % 3) + 1][(start / 3) + 1] = 1;
		
		for (int i = 0; i < n + 1; i++){
			dp[i][(barn % 3) + 1][(barn / 3) + 1] = -1;
		}
		
		for (int i = 0; i < n; i++){
			for (int y = 1; y <= 3; y++){
				for (int x = 1; x <= 3; x++){
					if (dp[i][x][y] == -1) continue;
					if (dp[i][x + 1][y] == -1){
						dp[i + 1][x][y] += dp[i][x][y];
					}
					else {
						dp[i + 1][x + 1][y] += dp[i][x][y];
					}
					if (dp[i][x - 1][y] == -1){
						dp[i + 1][x][y] += dp[i][x][y];
					}
					else {
						dp[i + 1][x - 1][y] += dp[i][x][y];
					}
					if (dp[i][x][y + 1] == -1){
						dp[i + 1][x][y] += dp[i][x][y];
					}
					else {
						dp[i + 1][x][y + 1] += dp[i][x][y];
					}
					if (dp[i][x][y - 1] == -1){
						dp[i + 1][x][y] += dp[i][x][y];
					}
					else {
						dp[i + 1][x][y - 1] += dp[i][x][y];
					}
				}
			}
		}
		
		mot = 0;
		for (int y = 1; y <= 3; y++){
			for (int x = 1; x <= 3; x++){
				if (dp[n][x][y] != -1){
					mot += dp[n][x][y];
				}
			}
		}
		end = e[0] - 'A';
		printf("%lf\n", double((double)(dp[n][(end % 3) + 1][(end / 3) + 1]) / (double)mot));
	}
	
	return (0);
}

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

char str[131072];

int main(void){
	register int i,sum=0;
	gets(str);
	for(i=1;i<strlen(str);i++)
		if(str[i]^str[i-1])
			sum++;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    agc032a()
}

fun agc032a() {
    val n = readLine()!!.toInt()
    val bList = readLine()!!.split(" ").map { it.toInt() }
        .toMutableList()

    val manipulation = mutableListOf<Int>()
    while (bList.isNotEmpty()) {
        val target = bList.withIndex().findLast { it.index + 1 == it.value }
        target?.let {
            bList.removeAt(it.index)
            manipulation.add(it.value)
        } ?: return println(-1)
    }

    println(manipulation.reversed().joinToString(System.lineSeparator()))
}


Measured memory_bytes: 37928
#include <bits/stdc++.h>
using namespace std;
int main(){
	int K;
	cin >> K;
	int s = 0;
	for(int i = 1; i <= K; i++) for(int j = 1; j <= K; j++) for(int m = 1; m <= K; m++) s += __gcd(i, __gcd(j, m));
	cout << s << "\n";
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    ld pi = 3.1415926535;
    ld r;
    cin >> r;
    cout << sp(10) << 2*r*pi << endl;
}

Measured memory_bytes: 3788
h, w = (list)(map(int, input().split()))
l = [[lin for lin in input()] for _ in range(h)]

gri = [['.' for i in range(w+2)] for _ in range(h+2)]
for i in range(1, h+1):
    for j in range(1, w+1):
        gri[i][j] = l[i-1][j-1]

flag = 1
for i in range(1, h+1):
    for j in range(1, w+1):
        if gri[i][j] == '#':
            if gri[i-1][j] == '.' and gri[i+1][j] == '.' and gri[i][j-1] == '.' and gri[i][j+1] == '.':
                flag = 0
if flag == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import qualified Data.Vector as V

main :: IO ()
main = do
  s <- map (subtract (fromEnum 'a') . fromEnum) <$> getLine :: IO [Int]
  let
    l = length s :: Int
    sSets = V.accum (flip IS.insert) (V.replicate 26 IS.empty) . flip zip [0..] $ s :: V.Vector IntSet
    f :: [Int] -> Maybe (Int, Maybe Int)
    f = foldl step Nothing
      where
        step :: Maybe (Int, Maybe Int) -> Int -> Maybe (Int, Maybe Int)
        step Nothing x = Just (0, IS.lookupGE 0 (sSets V.! x))
        step (Just (i, Just j)) x | Nothing <- m = Just (i + 1, IS.lookupGE 0 (sSets V.! x))
                                  | otherwise    = Just (i, m)
          where
            m = IS.lookupGT j (sSets V.! x)
        step _ _ = Just (0, Nothing)
    g :: Maybe (Int, Maybe Int) -> Int
    g (Just (i, Just j)) = l * i + j + 1
    g _                  = -1
  t <- map (subtract (fromEnum 'a') . fromEnum) <$> getLine :: IO [Int]
  print . g . f $ t


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

int main()
{
    int ans = 0;
    int count = 0;
    string s;
    cin >> s;
    
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
        {
            count++;
            if (ans <= count)
            {
                 ans = count;
            }
        }
        else
        {
            count = 0;
        }
    }

    cout << ans << endl;
    
}   

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  int N; cin >> N;
  vector<int> a(N); rep(i, N) cin >> a.at(i);
  bool odd = (N%2==1);
  vector<int> ans(N);
  if(odd){
    rep(i, N){
      if(i%2==1){
        ans.at(N/2+i/2+1) = a.at(i);
      } else {
        ans.at(N/2-i/2) = a.at(i);
      }
    }
  } else {
    rep(i, N){
      if(i%2==1){
        ans.at(N/2-i/2-1) = a.at(i);
      } else {
        ans.at(N/2+i/2) = a.at(i);
      }
    }
  }
  cout << ans.at(0);
  rep(i, N-1) cout << " " << ans.at(i+1);
  cout << endl;
  return 0;
}


Measured memory_bytes: 4812
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rep2(i,s,t) for(int i = s; i <= t; ++i)
#define rev(i,n) for(int i = n-1; i >= 0; --i)
#define rev1(i,n) for(int i = n; i > 0; --i)
#define rev2(i,s,t) for(int i = s; i >= t; --i)
#define F first
#define S second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
int main()
{
  int n; cin >> n;
  string s; cin >> s;

  vii dp(n+1, vi(n+1, 0));
  int res = 0;
  rep1(i,n) {
    rep1(j,n) {
      if(s[i-1] == s[j-1]) {
	dp[i][j] = min(abs(j - i), dp[i-1][j-1] + 1);
      }
      chmax(res, dp[i][j]);
    }
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 101204
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int LCS(string X, string Y) {

	int m, n;
	m = X.size();
	n = Y.size();

	int c[m + 1][n + 1];

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

	X = ' ' + X;
	Y = ' ' + Y;

	int maxl = 0;
	for (int i = 1; i <= m; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (X[i] == Y[j]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			} else {
				c[i][j] = max(c[i - 1][j], c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}

	return maxl;
}

int main() {

	int q;
	scanf("%d", &q);

	for (int i = 0; i < q; ++i) {
		string X, Y;
		cin >> X >> Y;
		cout << LCS(X, Y) << endl;
	}

	return 0;

}

Measured memory_bytes: 7072
#include <stdio.h>
int main(void) {
	long long n, a, count=0, max=-1000000L, min=1000000L, sum=0;
	scanf("%lld", &n);
	while(count<n){
		count++;
		scanf("%lld", &a);
	    sum+=a;
	    if(max<a){
	    	max=a;
	    }
	    if(min>a){
	    	min=a;
	    }
	}
	printf("%lld %lld %lld\n", min, max, sum);
	return 0;
}



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

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

    int ans = a + a * a + a * a * a;

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


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

int main() {
  ll N, P;
  cin >> N >> P;
  ll i=2, l=1;
  
  while (P != 1) {
    if (P % i == 0) {
      ll ni = 0;
      while (P%i == 0) {
        ni++;
        P /= i;
      }
      l *= pow(i, ni / N);
    } else if (i*i > P) {
      if (N == 1) l *= P;
      break;
    } else {
      i++;
    }
  }
  cout << l << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (max(a, b) <= 8) {
		cout << "Yay!" << endl;
		return 0;
	}
	cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll uint64_t
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <set <int> >
#define inf 1000000000
 
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    int n;
    cin >> n;
    int in;
    int cont = 1;
    int ans = 0;
    while (n--) {
        cin >> in;
        if (in % 2 && cont % 2) ans++;
        cont++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int x;
    cin >> x;
    if(x == 5 || x == 3 || x == 7) puts("YES");
    else puts("NO");
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <utility>
using namespace std;
typedef unsigned long ulong;

class Solver {

public:
	static void solve() {
		long n, m, d;
		cin >> n >> m >> d;

		long as[11];
		for (int i = 0; i < m; i++)cin >> as[i];

		long res = n;
		long rs[1005][11];
		for (int i = 0; i < d; i++) {
			for (int j = 0; j < m; j++) {
				cin >> rs[i][j];
			}
		}

		for (int i = 0; i < d; i++) {
			long lcm = 1;

			for (int j = 0; j < m; j++) {
				if (rs[i][j] == -1)continue;

				long firstMargin = res % as[j];
				long margin = firstMargin;
				while (margin != rs[i][j]) {
					margin = margin + (lcm / as[j] + 1) * as[j] - lcm;
					margin %= as[j];
					res -= lcm;
					if (res < 0 || margin == firstMargin) {
						cout << -1 << endl;
						return;
					}
				}

				lcm = LCM(lcm, as[j]);
			}
		}

		cout << res << endl;
	}

	static long GCD(long a, long b) {
		if (b > a) {
			long temp = b;
			b = a;
			a = temp;
		}
		long c = b;
		do {
			c = a % b;
			a = b;
			b = c;
		} while (c > 0);
		return a;
	}

	static long LCM(long a, long b) {
		long c = GCD(a, b);
		return a / c * b;
	}

};

int main() {
	Solver::solve();
	return 0;
}


Measured memory_bytes: 3108
/**
 * THIS IS CFMASTER'S CODE !
 * HACK IT IF YOU CAN !
**/
#include <bits/stdc++.h>
 
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> dist;
  for (int i = 1; i < n; i++) {
    dist.push_back(a[i] - a[i - 1]);
  }
  dist.push_back(k - a[n - 1] + a[0]);
  cout << k - *max_element(dist.begin(), dist.end()) << '\n';
  return 0;
}

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

void solve()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a * b >= c * d)
        cout << a * b << endl;
    else
        cout << c * d << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3560
n,a,b = map(int,input().split())
if n == 1 and a != b or b-a <= -1:
  print(0)
elif n == 2:
  print(1)
else:
  min_ans = a*(n-1)+b
  max_ans = b*(n-1)+a
  ans = max_ans - min_ans + 1
  print(ans)
  

Measured memory_bytes: 2940
/**
 * @Author:      G_bg
 * @DateTime:    2019-07-27 20:08:34
 * @Description: 
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9+7;
const int maxn = 1e5+10;
LL a[maxn],b[maxn];
int main(int argc, char const *argv[]) {
    ios::sync_with_stdio(0);cin.tie(0);
    int n;cin >> n;
    for(int i = 1;i <= n+1;i++) cin >> a[i];
    for(int i = 1;i <= n;i++) cin >> b[i];
    LL sum = 0;
    for(int i = 1;i <= n+1;i++){
        if(i > 1 && b[i-1] > 0){
            if(a[i] >= b[i-1]) sum += b[i-1],a[i] -= b[i-1],b[i-1] = 0;
            else sum += a[i],b[i-1] -= a[i],a[i] = 0;
        }
        if(i < n+1){
            if(a[i] >= b[i]) sum += b[i],a[i] -= b[i],b[i] = 0;
            else sum += a[i],b[i] -= a[i],a[i] = 0;
        }
    }
    cout << sum << endl;
    //system("pause");
    return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	ll d;
	cin >> s >> d;
	int n = s.size();
	vector<vvl> dp(n + 1, vvl(d, vl(2, 0)));
	dp[0][0][1] = 1;
	REP(i, n) {
		REP(j, d) {
			dp[i + 1][(j + s[i] - '0') % d][1] += dp[i][j][1];
			dp[i + 1][(j + s[i] - '0') % d][1] %= MOD;
			REP(k, 10) {
				dp[i + 1][(j + k) % d][0] += dp[i][j][0];
				dp[i + 1][(j + k) % d][0] %= MOD;
			}
			REP(k, s[i] - '0') {
				dp[i + 1][(j + k) % d][0] += dp[i][j][1];
				dp[i + 1][(j + k) % d][0] %= MOD;
			}
		}
	}
	cout << (dp[n][0][1] + dp[n][0][0] + MOD - 1) % MOD << endl;
}

Measured memory_bytes: 55808
#include <cstdio>
    #include <cstring>
    #include <string>
    #include <iostream>
    #include <algorithm>
    using namespace std;
     
    const int maxn=1e5+5;
    int a[maxn],vis[maxn];
     
    int main()
    {
        int n,c,k;
        scanf("%d%d%d",&n,&c,&k);
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        sort(a,a+n);
        int num=0,cnt=0,flag=0,minn=a[0];
        for(int i=0;i<n;i++)
        {
            if(a[i]-minn>k)
            {
                cnt++;
                num=1;
                minn=a[i];
            }
            else
            {
                num++;
            }
            if(num==c)
            {
                num=0;cnt++;
                minn=a[i+1];
            }
        }
        if(num)
            cnt++;
        printf("%d\n",cnt);
    }

Measured memory_bytes: 640
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func binarySearch(a []int, b, e, k int) (bool, int) {
	n := len(a)

	if k <= a[b] {
		return true, b
	} else if a[e-1] < k {
		return true, n
	}

	if e-b <= 2 {
		if a[b] < k && k <= a[b+1] {
			return true, b + 1
		} else if a[b+1] < k && k <= a[b+2] {
			return true, b + 2
		}
	}

	mid := (b + e) / 2
	if a[mid] < k && k <= a[mid+1] {
		return true, mid + 1
	}

	if a[mid] >= k {
		okLeft, iLeft := binarySearch(a, b, mid+1, k)
		if okLeft {
			return true, iLeft
		}
	}

	okRight, iRight := binarySearch(a, mid, e, k)
	if okRight {
		return true, iRight
	}

	return false, -1
}

var infty = 1000000000 + 10

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	// dp[i] := 長さがi+1であるようなLISの最終要素
	dp := make([]int, n)
	for i := 0; i < n; i++ {
		dp[i] = infty
	}

	dp[0] = a[0]
	for i := 1; i < n; i++ {
		ok, j := binarySearch(dp, 0, len(dp), a[i])
		// fmt.Println(a[i], ok, j)
		if ok {
			dp[j] = a[i]
		}
		// fmt.Println(dp)
	}
	i := n - 1
	for ; i >= 0; i-- {
		if dp[i] < infty {
			break
		}
	}
	fmt.Println(i + 1)
}



Measured memory_bytes: 4280
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

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

    string s[3]={"KIH","B","R"};
    set<string> st;
    for(int i=0;i<(1<<4);i++){
        string tmp;
        for(int j=0;j<4;j++){
            if((i>>j)&1) tmp+="A";
            if(j!=3) tmp+=s[j];
        }
        st.insert(tmp);
    }
    
    //debug(st);

    string t;
    cin>>t;
    if(st.count(t)){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
S = input()
li = ['A', 'T', 'G', 'C']

maxlen = 0
templen = 0
for i in range(len(S)):
    if S[i] in li:
        templen += 1
    else:
        maxlen = max(maxlen, templen)
        templen = 0
maxlen = max(maxlen, templen)
print(maxlen)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n, k, r, s, p;
	string t;
	cin >> n >> k>>r>>s>>p>>t;
	vector <int>won(n, 1);
	int ans = 0;
	rep(i, n) {
		if (i < k) {
			if (t[i] == 'r')ans += p;
			else if (t[i] == 's')ans += r;
			else ans += s;
		}
		else {
			if (t[i - k] == t[i] && won[i - k] == 1) {
				won[i] = 0;
			}
			else {
				if (t[i] == 'r')ans += p;
				else if (t[i] == 's')ans += r;
				else ans += s;
			}
		}
	}
	print(ans);

}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i= 0;i<(int)c;i++)
int main() {
 int A,B;
 cin >> A >> B;
 if(A>=13){
   cout << B << endl;
 }else if(A<=5){
   cout << 0 << endl;
 }else{
   cout << B/2 << endl;
 }
 return 0;
 }



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#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 <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

//#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define FST first
#define SND second

#define MAX_N   (2000)                  // 10^3
#define MAX_Q   (200000)                  // 10^5
// #define MAX_N   (1000000000)              // 10^9
// #define MAX_N   (1000000000000000000)     // 10^18
#define BASE    (1000000000 + 7)          // 10^9 + 7
#define INFI    (1000000000 + 7)          // 10^9 + 7
#define INFL    (1000000000000000000 + 7) // 10^18 + 7

int N, M, Q;
string MAP[MAX_N + 2];
int CNTB[MAX_N + 1][MAX_N + 1];
int CNTV[MAX_N + 1][MAX_N + 1];
int CNTH[MAX_N + 1][MAX_N + 1];

void print_matrix(int cnt[MAX_N + 1][MAX_N + 1], int n, int m) {
  for (int i = 1; i < N + 1; i++) {
    for (int j = 1; j < M + 1; j++) {
      cout << cnt[i][j];
    }
    cout << endl;
  }
}

int count_of(int i, int j, int cnt[MAX_N + 1][MAX_N + 1]) {
  return cnt[i - 1][j] + cnt[i][j - 1] - cnt[i - 1][j - 1];
}

void make_matrices() {
  for (int i = 0; i < N + 1; i++) CNTB[i][0] = CNTV[i][0] = CNTH[i][0] = 0;
  for (int i = 0; i < M + 1; i++) CNTB[0][i] = CNTV[0][i] = CNTH[0][i] = 0;

  for (int i = 1; i < N + 1; i++) {
    for (int j = 1; j < M + 1; j++) {
      CNTB[i][j] = count_of(i, j, CNTB);
      CNTV[i][j] = count_of(i, j, CNTV);
      CNTH[i][j] = count_of(i, j, CNTH);
      if (MAP[i][j] == '1') {
        CNTB[i][j]++;
        if (MAP[i - 1][j] == '1') CNTV[i][j]++;
        if (MAP[i][j - 1] == '1') CNTH[i][j]++;
      }
    }
  }

  #ifdef DEBUG
  print_matrix(CNTB, N, M);
  cout << endl;
  print_matrix(CNTV, N, M);
  cout << endl;
  print_matrix(CNTH, N, M);
  cout << endl;
  #endif

}

int count_of_range(int r1, int c1, int r2, int c2, int cnt[MAX_N + 1][MAX_N + 1]) {
  return cnt[r2][c2] - cnt[r2][c1 - 1] - cnt[r1 - 1][c2] + cnt[r1 - 1][c1 - 1];
}

int query(int r1, int c1, int r2, int c2) {
  int b = count_of_range(r1, c1, r2, c2, CNTB);
  int v = count_of_range(r1 + 1, c1, r2, c2, CNTV);
  int h = count_of_range(r1, c1 + 1, r2, c2, CNTH);
  return b - v - h;
}

int main() {
  cin >> N >> M >> Q;
  MAP[0] = string(M + 2, '0');
  MAP[N + 1] = string(M + 2, '0');
  for (int i = 1; i <= N; i++) {
    cin >> MAP[i];
    MAP[i] = "0" + MAP[i] + "0";
  }

#ifdef DEBUG
  for (int i = 0; i < N + 2; i++) cout << MAP[i] << endl;
  cout << endl;
#endif

  make_matrices();

  for (int i = 0; i < Q; i++) {
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    cout << query(r1, c1, r2, c2) << endl;
  }


  return 0;
}


Measured memory_bytes: 56704
S = input() # sを取得し、strに値を入れる
if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)
else:
    print("error!")

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  string S;
  cin >> S;

  const int n = S.size();
  int ans = 0;
  for (int i = 0; i < n / 2; i++) {
    ans += (S[i] != S[n - i - 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;

int main(){

	int x, y, sum=0, ave=0;
	double a=0, b=0;

	while(scanf("%d,%d",&x,&y)+1){
		sum = sum + x*y;
		a = a + 1;
		b = b + y;
	}
	
	ave = roundf(b/a);
	cout << sum << "\n" << ave << endl;

	return 0;
}

Measured memory_bytes: 1216
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        Integer array[] = {1, 1, 1, 1, 1,1, 1, 1, 1, 1}; 
        for(int i = 0; i < 10; ++i){
        	array[i] = sc.nextInt();
        }
        Arrays.sort(array, Comparator.reverseOrder());
        for(int i = 0; i < 3; ++i){
            System.out.println(array[i]);
        }
    }
}

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

#define SEG_NUM (1<<20)

pair<long, long> seg[SEG_NUM*2];

long find(int i){
    i += SEG_NUM;
    long ans = 2147483647;
    int time = 0;
    while(i > 0){
        if(time < seg[i].first) {
            ans = seg[i].second;
            time = seg[i].first;
        }
        i /= 2;
    }
    return ans;
}

void update(int s, int t, long x, long time){
    s += SEG_NUM;
    t += SEG_NUM;
    while(s < t){
        if(s % 2 == 1){
            seg[s].first = time;
            seg[s].second = x;
            s++;
        }
        s /= 2;
        if(t % 2 == 1){
            seg[t-1].first = time;
            seg[t-1].second = x;
            t--;
        }
        t /= 2;
    }
}

int main() {
    for(long i=0;i<2*SEG_NUM;++i){
        seg[i] = make_pair(0, 2147483647);
    }
    int n, q;
    cin>>n>>q;
    long query, s, t, x, i;
    for(int time=0;time<q;++time){
        cin>>query;
        if(query){
            cin>>i;
            cout<<find(i)<<endl;
        }
        else {
            cin>>s>>t>>x;
            update(s, t+1, x, time+1);
        }
    }
}




Measured memory_bytes: 35888
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

long long int dist(P a, P b) {
	return abs(a.first - b.first) + abs(a.second - b.second);
}

int main() {
	long long int h, w, d;
	cin >> h >> w >> d;
	vector<P> data(h*w);
	long long int a;
	for (long long int i = 0; i < h; i++) {
		for (long long int j = 0; j < w; j++) {
			cin >> a;
			data[a - 1] = P(i, j);
		}
	}
	vector<long long int> calc(h*w, 0);
	for (long long int i = 0; i < d; i++) {
		for (long long int j = i + d; j < h*w; j += d) {
			calc[j] = calc[j - d] + dist(data[j], data[j - d]);
		}
	}
	long long int q;
	cin >> q;
	long long int l, r;
	for (long long int i = 0; i < q; i++) {
		cin >> l >> r;
		cout << calc[r - 1] - calc[l - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n; cin >> n;
  for(int i = 0; i < n - 1; i++) {
    int t; cin >> t;
    a[t]++;
  }
  for(int i = 1; i <= n; i++) {
    cout << a[i] << "\n";
  }
}

Measured memory_bytes: 4352
S = input()
N = len(S)
f = True

for i in range(N):
    if S[i] != S[N-i-1]:
        f = False
        break

N2 = (N-1)//2
for i in range(N2):
    if S[i] != S[N2-i-1]:
        f = False
        break

N3 = (N+3)//2
for i in range(N3,N):
    if S[i] != S[N-i-1]:
        f = False
        break
if f:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

int n, m, k;
bool flag = false;

int main() {
	cin >> n >> m >> k;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			flag = flag || (n - i)*j + (m - j)*i == k;
		}
	}
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
k,n=map(int,input().split())
a_list=list(map(int,input().split()))
ans=10**9
for i in range(n):
    if i==0:
        t=a_list[n-1]-a_list[0]
        ans=t
    else:
        t=k-a_list[i]+a_list[i-1]
        ans=min(ans,t)
print(ans)


Measured memory_bytes: 73164