akhauriyash/Code-Regression huggingface dataset:
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint ans = 0;
lint p;
lint t = 0;

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        t++;
        ans += a + b;
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if(a % 2 == 0 || b % 2 == 0){
        cout << "Even" << endl;
    }
    else {
        cout << "Odd" << endl;
    }
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int s = sc.nextInt();
    
    int count = 0;
    
    for (int x = 0; x <= k; x++) {
      for (int y = 0; y <= k; y++) {
        int z = s - x -y;
        if (z >= 0 && z <= k) {
          count++;
        }
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <math.h>

int main() {
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	double a, b;
	a = (double)A;
	b = (double)B;
	double pi = 3.1415926535897932384626;
	double deg_to_rad = pi / 180.0;
	double c = deg_to_rad * (double)C;

	// S
	double S = 0.5 * a * b * sin(c);

	double sin_c = sin(c);
	double cos_c = cos(c);

	// h
	double h = b * sin_c;

	double l = sqrt(b * b * sin_c * sin_c + b * b * cos_c * cos_c - 2.0 * a * b * cos_c + a * a);

	// L
	double L = a + b + l;
	printf("%lf %lf %lf", S, L, h);
	return 0;
}

Measured memory_bytes: 2964
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
      long long N,M;
      cin>>N>>M;
      long long ans = min(N,M/2);
      
      if(2LL*ans < M){
           ans += (M-2LL*ans)/4;
      }
      cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

int N;
long long h[100010];
long long dp[100010];

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

  for (int i = 0; i < 100010; ++i) dp[i] = INF;

  dp[0] = 0;

  for (int i = 1; i < N; ++i) {
    chmin(dp[i], dp[i-1] + abs(h[i] - h[i - 1]));
    if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i-2]));
  }

  cout << dp[N-1] << endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <string>
#define NMAX 15
using namespace std;
string s,t;
int main(){
    int a,b,c,k,cnt = 0;
    cin >> a >> b >> c >> k;
    int s;
    // 2 1 1 3
    if(a + b < k){
      cout << (k - ( a + b )) * -1 + a;
    }
    if(a >= k)
      cout << k;
    if(a + b >= k && a < k){
      cout << a;
    }
    return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int ss[2005][2005];
int t[2005];

int make(int n,int x){
	int s[2005];
	int i;
	memset(s,0,sizeof(s));
	for(i=1;i<x;i++){
		s[i]=2005;
	}
	for(i=x;i<=n;i++){
		s[i]=s[i-x]-1;
	}
	for(i=0;i<n;i++){
		t[i]=s[i+1]-s[i];
	}
}

int main(){
	int a,b,c,d;
	int x,y;
	int n,m;
	int i,j,k;
	cin>>n>>m>>x>>y;
	if(n%x==0 && m%y==0){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	if(n%x!=0)make(n,x);
	else make(m,y);
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			printf("%d%c",(n%x!=0)?t[i]:t[j],(j==m-1)?'\n':' ');
		}
	}
	return 0;
	
}


Measured memory_bytes: 1536
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int numbers[] = new int[n];
        long sum = 0;
        for(int i = 0; i < n; i++){
            numbers[i] = sc.nextInt();
            sum += numbers[i];
        }
        Arrays.sort(numbers);
        
        System.out.println(numbers[0] + " " + numbers[n - 1] + " " + sum);
    }
}


Measured memory_bytes: 41968
#include <stdio.h>

long max(long a,long b){
  if(a > b){
    return a;
  }
  return b;
}

int main(void){
  long X,t;
  scanf("%ld%ld",&X,&t);


  printf("%ld\n",max(0,X-t));

  return 0;
}

Measured memory_bytes: 128
import numpy as np

def main():
    #n, k = map(int,input().split())
    k = int(input())
    j = 0
    sum = []
    for i in range(k):
        num = i+1
        if num % 15 == 0:
            pass
        elif num % 3 == 0:
            pass
        elif num % 5 == 0:
            pass
        else:
            sum.append(num)
    print(np.sum(np.array(sum)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 52296
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fr first
#define sc second
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int N=2e5+5,inf=1e9,YL=1e9+7;
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
int col[N],w[N],mn[N],siz[N],fnv[N],fac[N],id[N],o[N];
using std::min;
#define mk std::make_pair
std::vector<int>G[N];
inline bool cmp(const int &a,const int &b){return w[a]<w[b];}
int main()
{
	int n=in(),X=in(),Y=in(),mn1=YL,mn2=YL;fac[0]=fnv[0]=1;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=2;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=1,x;i<=n;++i)x=in(),G[x].push_back(in());
	for(int i=1;i<=n;++i)
		if(G[i].size())
		{
			std::sort(G[i].begin(),G[i].end());
			mn2=min(mn2,mn[i]=G[i][0]);
			if(mn2<mn1)std::swap(mn1,mn2);
		}
		else mn[i]=YL;
	int ans=1,tot=0;
	for(int i=1;i<=n;++i)
	{
		int mm=mn[i]==mn1?mn2:mn1,sz=G[i].size();
		while(sz>1&&G[i][sz-1]+mn[i]>X&&G[i][sz-1]+mm>Y)--sz,G[i].pop_back();
		if(mn[i]+mn1<=Y)ans=1ll*ans*fnv[sz]%YL,tot+=sz;
	}
	printf("%d\n",1ll*ans*fac[tot]%YL);
	return 0;
}


Measured memory_bytes: 14848
/* Life is all about calculated risks.
    But man am I bad at math. */

#include <bits/stdc++.h> 
#define ll long long int
#define INF (ll)1e12
#define MOD 1000000007

#define DEBUG(x) cerr<<"> "<< #x << ':' <<x<<endl;

using namespace std;

ll f(ll i, ll j);

ll h,w;
vector<vector<char>> mat(1010, vector<char>(1010,'a'));

vector<vector<ll>> dp(1010,vector<ll>(1010,-1));

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

    cin>>h>>w;
    for(ll i=1; i<=h; i++)
    {
        for(ll j=1; j<=w; j++)
        {   
            cin>>mat[i][j];
        }
    }

    cout<<f(h,w)<<endl;

    return 0;
}

ll f(ll i, ll j)
{
    if(i<1 || i>h || j<1 || j>w)
    {   
        return 0;
    }
    if(dp[i][j] != -1)
    {
        return dp[i][j];
    }
    if(mat[i][j] == '#')
    {
        return dp[i][j] = 0;
    }
    if(i==1 && j==1)
    {
        return dp[i][j] = 1;
    }

    ll paths = 0;

    paths = (paths + f(i-1,j))%MOD;
    paths = (paths + f(i,j-1))%MOD;

    return dp[i][j] = paths;
}

Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, A;
  cin >> N >> A;
  vector<int64_t> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
    vec.at(i) -= A;
  }
  int64_t dp[N+1][N*100]; //i番目まで考えた時に和がjであるパターンの数
  int64_t plus = N*50;
  for(int i=0; i<N+1; i++){
    for(int j=0; j<N*100; j++){
      dp[i][j] = 0;
    }
  }
  for(int i=0; i<N+1; i++){
    dp[i][0+plus] = 1;
  }
  for(int i=0; i<N; i++){
    for(int j=0; j<N*100; j++){
      dp[i+1][j] = dp[i][j] + dp[i][j - vec.at(i)];
    }
  }
  
  cout << dp[N][0+plus] - 1 << endl;
}

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

using namespace std;

int main() {
  int k;
  cin >> k;
  queue<long long> que;
  for (int i=1; i<=9; i++) que.push(i);
  
  for (int i=0; i<k-1; i++) {
    long long tmp = que.front(); que.pop();
    if (tmp % 10 != 0) que.push(tmp * 10 + tmp % 10 - 1);
    que.push(tmp * 10 + tmp % 10);
    if (tmp % 10 != 9) que.push(tmp * 10 + tmp % 10 + 1);
  }
  
  cout << que.front() << endl;
  return 0;
}


Measured memory_bytes: 1792
// УЛЬЯНА САМАЯ ЛУЧШАЯ В МИРЕ!!!!!!!!!!!!!

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

using std::abs;
using std::min;
using std::max;
using std::swap;

using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;

using std::sort;
using std::reverse;

using ll = long long;

#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())
#define endl '\n'

struct __init {
    __init() {
        cin.tie(nullptr);
        std::iostream::sync_with_stdio(false);
        cout << std::fixed << std::setprecision(10);
        cerr << std::fixed << std::setprecision(5);
        std::mt19937 rand(300);
    }

    ~__init() {
        #ifdef SEREZHKA
            cerr << "Time elapsed: " << static_cast<double>(clock()) / CLOCKS_PER_SEC << endl;
        #endif
    }
} init;

const ll inf = (ll) 1e9 + 7ll;
const int maxn = (int) 1e6 + 17;

ll n, m;

bool read() {
    if (!(cin >> n >> m))
        return false;

    return true;
}

void solve() {
    if (n > m)
        swap(n, m);

    if (n == 1) {
        if (m == 1)
            cout << 1 << endl;
        else
            cout << m - 2 << endl;

        return ;
    }

    cout << max(0ll, n - 2) * (0ll, m - 2) << endl;
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define double long double
#define mod 1000000007
#define w(t) int t=1; while(t--)
#define f(i,a,n) for( int i=a;i<n;i++)
#define pb push_back
#define pob pop_back
#define mk make_pair
#define ARMY ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
vector<string> v;
int dp[101][100001];
int solve(int n,int *v,int *w,int wt)
   {  
    for(int i=0;i<=100000;i++)
      dp[1][i]=1e9+1;
      dp[1][0]=0;
      dp[1][v[0]]=w[0];
      for(int i=2;i<=n;i++)
         {
            for(int j=0;j<=100000;j++)
             {
                dp[i][j]=dp[i-1][j];
                if(v[i-1]>j)
                  continue;
               dp[i][j]=min(w[i-1]+dp[i-1][j-v[i-1]],dp[i][j]);
             }
         }
         int ans=0;
         f(i,0,100001)
           if(dp[n][i]<=wt)
             ans=i;
           return ans;
            
   }
int32_t main()
  {
   ARMY
   w(t)
    {
       int n,wt;
       cin>>n>>wt;
       int a[n],w[n];
       f(i,0,n)
       cin>>w[i]>>a[i];
       cout<<solve(n,a,w,wt);

    } 
  }

  

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

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

    char mem=S[0];
    int ans=1;
    REP(i,1,N){
        if(S[i]!=mem){
            mem=S[i];
            ans++;
        }
    }
    P(ans);
}

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

int main() {
  int x,y,z;cin>>x>>y>>z;
  cout<<(x-z)/(y+z)<<endl;
}

Measured memory_bytes: 3568
# addtion_resultに計算結果を一時保存して1ループ終了ごとにlineをaddtion_resultに置き換えて次のループに行くことでfor文で実装可能になる


while True:
    try:
        line = [int(x) for x in list(input())]
    except EOFError:
        break

    addition_result =[]
    while len(line) > 1:
        for i in range(len(line)-1):
            addition_result.append( (line[i] + line[i+1])%10 )
        line = addition_result[:]
        addition_result = []
    print(line[0])


Measured memory_bytes: 5600
//#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <math.h>
 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
// template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
 
#define ll long long int
#define ull unsigned long long int
 
#define lp(i,n) 	    for(int i=0;i<(int)(n);i++)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);i++)
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);i--)
 
#define all(v)  	 ((v).begin()), ((v).end())
#define sz(v)    	 ((int)((v).size()))
#define clr(v, d)    memset(v, d, sizeof(v))
#define PB           push_back
#define MP           make_pair
#define N 100006
 
#define PI 3.14159265359
 
ll gcd(ll a, ll b);
vector<string> split(string target,unsigned char c );
 
 
ll n,k,t,m,x,y,l,r;
 
bool isPrime(ll h); 
 
ll ans;

 
ll mod=1e9 +7;
bool cmp(pair<int,string>& a,pair<int,string>& b){
	if(a.first==b.first)
		return a.second<b.second;
	return a.first>b.first;
}


 
int main() {
// freopen("d.in","r",stdin); 
// 	freopen("d_out.txt","w",stdout); 
cout.precision(7);
ios_base::sync_with_stdio(false);
cin.tie(NULL);  cout.tie(NULL);

cin>>n;
map<string,int>cnt;
vector<pair<int,string>>v;
string s;
lp(i,n){
	cin>>s;
	cnt[s]++;
}
for(auto u=cnt.begin();u!=cnt.end();u++){
	v.push_back(MP(u->second,u->first));
}
sort(all(v),cmp);
ans=v[0].first;
lp(i,sz(v)){
	if(v[i].first==ans)cout<<v[i].second<<"\n";
	else break;
}


	
 
 
}

ll gcd(ll a, ll b){
	return b==0?a:gcd(b,a%b);
}
 
 
vector<string> split(string target,unsigned char c ){
	string d="";
	vector<string>arr;
	for(auto n:target)
	{
		if(n!=c)
		d+=n;
		else if(d!="")
		arr.push_back(d),d="";
	}
	if (d!="")
	arr.push_back(d),d="";
	return arr;
}
// bool isPrime(ll h){
//      for(ll i=0;primes[i]*primes[i]<= h;i++)
//      if (h%primes[i]==0)
//      	return 0;
//      return h!=1;
//  }
 bool isPrime(ll g){
   if((g%2==0 && g>2) || g==1)return 0;
   for(ll i=3;i*i<=g;i+=2)if(g%i==0)return 0;
   return 1;   
 
 }

Measured memory_bytes: 27504
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    size_t size = 2000000; 
    char S[size];
    char T[size];
    fgets(S, size, stdin);
    fgets(T, size, stdin);
    int rs = 0;
    for (int i=0; S[i] != '\0'; i++){
        if (S[i] != T[i]) ++rs;
    }
    printf("%d\n",rs);
    return 0;
}

Measured memory_bytes: 1984
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
#define mp make_pair
#define pb push_back
#define se second
#define fi first
#define N 100007
ll a[200007];
//string a, b;
//ll dp[200007];
vector<ll> v[200007];
ll vis[200007];
ll cnt=0, ans=0, maxi=-1, m;

void dfs(ll node, ll cnt, ll maxi) {
    vis[node]=1;
    if(a[node]>0) cnt++;
    else cnt=0;
    maxi=max(maxi,cnt);
    if(v[node].size()==1 && node!=1) {
        if(maxi<=m) ans++;
        //maxi=-1;
        //return;
    }  
    for(int i=0;i<v[node].size();i++) {
        if(!vis[v[node][i]]) {
            dfs(v[node][i], cnt, maxi);
        }
    }
}
 
void solve() {
    ll i, j, k, l, test, n, q, x, y, z;
    cin>>n>>k;
    ll c=0;
    while(n--) {
        cin>>x>>y;
        if(sqrt((x*x)+(y*y))<=k) c++;
    }
    cout<<c;
}
int main() { 
    #ifndef ONLINE_JUDGE
        freopen("input1.txt", "r", stdin);
        freopen("output1.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0; 
}


Measured memory_bytes: 8380
#include <stdio.h>
#include <math.h>

int main(){
  int a,b,c,i,n;

  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%d%d%d",&a,&b,&c);
    if (((pow(a,2)+pow(b,2))==pow(c,2)) || ((pow(c,2)+pow(b,2))==pow(a,2)) || (\
(pow(a,2)+pow(c,2))==pow(b,2))){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }

  return 0;
}

Measured memory_bytes: 580
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,m,ans=1,acnt=0,bcnt=0; cin>>n>>m;
    vector<ll> a(n+1,-1),b(m+1,-1);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    sort(al(a)); sort(al(b));
    reverse(al(a)); reverse(al(b));
    for(int i=m*n;i>=1;i--){
        if(a[acnt]==i && b[bcnt]!=i){
            ans=ans*bcnt%MOD; acnt++;
        }
        else if(a[acnt]!=i && b[bcnt]==i){
            ans=ans*acnt%MOD; bcnt++;
        }
        else if(a[acnt]!=i && b[bcnt]!=i){
            ans=ans*(acnt*bcnt-(n*m-i))%MOD;
        }
        else{
            acnt++; bcnt++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if((a <= c) && (b >= c)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> pa;

#define fst first
#define snd second
#define pb push_back

const int maxn=500005,maxm=512;
const double pi=acos(-1.0);
//const ll mod=1000000007;
const ll mod=998244353;
const double eps=1e-8;

int n,m,k,ans=0;

char c[10][10];

int main()
{
	int i,j,ii,jj;
	scanf("%d %d %d",&n,&m,&k);
	for(i=0;i<n;i++) scanf("%s",c[i]);
	for(ii=0;ii<(1<<n);ii++)
    {
        for(jj=0;jj<(1<<m);jj++)
        {
            int tt=0;
            for(i=0;i<n;i++)
            {
                if(ii>>i&1) continue;
                for(j=0;j<m;j++)
                {
                    if(jj>>j&1) continue;
                    tt+=(c[i][j]=='#');
                }
            }
            ans+=(tt==k);
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3760
import java.util.Scanner;
public class Main {
	void watch(){
		int h,m,s;
		Scanner s1 = new Scanner(System.in);
		s = s1.nextInt();
		h = s/3600;
		s-=h*3600;
		m = s/60;
		s-=m*60;
		System.out.println(h + ":" + m + ":" + s);
	}
	public static void main(String args[]){
		Main m1 = new Main();
		m1.watch();
	}
}

Measured memory_bytes: 26188
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
pre = -2
for i in A:
  ans += B[i-1]
  if pre + 1 == i:
    ans += C[i-2]
  pre = i
print(ans)

Measured memory_bytes: 9192
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	int sum = 0;
	cin >> a >> b;
	if (a > b) {
		sum += a;
		a--;
	}
	else {
		sum += b;
		b--;
	}
	if (a > b) {
		sum += a;
	}
	else {
		sum += b;
	}
	cout << sum << endl;
	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  if(A[0] != 0) {
    cout << -1 << endl;
    return 0;
  }
  bool ok = true;
  rep(i,N-1) {
    if(A[i+1] - A[i] > 1) {
      ok = false;
      break;
    }
  }
  if(!ok) {
    cout << -1 << endl;
    return 0;
  }
  int p = 0;
  ll cnt = 0;
  srep(i,1,N) {
    if(A[i] == p+1) {
      cnt++;
      p++;
      continue;
    } else if(A[i] == 0) {
      p = 0;
      continue;
    } else {
      cnt += A[i];
      p = A[i];
      continue;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

int main(void){

  int i,j,k;
  int w,h;
  int sum,sum1,sum2,sum3,sum4;
  int root[101][101][5];

  while(1){

    scanf("%d %d",&w,&h);

    if(w==0&&h==0){
      break;
    }
    for(i=1;i<h;i++){
      root[i][0][2]=1;
    }
    for(j=1;j<w;j++){
      root[0][j][1]=1;
    }
    for(i=1;i<h;i++){
      for(j=1;j<w;j++){
	root[i][j][1]=root[i][j-1][1]+root[i][j-1][3];
	root[i][j][2]=root[i-1][j][2]+root[i-1][j][4];
	root[i][j][3]=root[i][j-1][2];
	root[i][j][4]=root[i-1][j][1];

	for(k=1;k<=4;k++){
	  root[i][j][k]=root[i][j][k]%100000;
	}
      }
    }
    sum=root[h-1][w-1][1]+root[h-1][w-1][2]+root[h-1][w-1][3]+root[h-1][w-1][4];
      printf("%d\n",sum%100000);
  }

  return 0;
}

Measured memory_bytes: 800
program Traveling
    implicit none
    integer(4):: n,i
    integer(4):: t,x,y

    read*, n

    do i=1,n
        read*, t,x,y
        if (t < x+y .or. mod(t,2) /= mod(x+y,2)) then
            print*, 'No'
            stop
        end if
    end do

    print*, 'Yes'


end program Traveling

Measured memory_bytes: 256
#include <stdio.h>

main(){
  int i,n,m;
  scanf("%d",&n);
  for(i=1;i<10;i++){
    if(n%i==0){
      m=n/i;
      if(0<m && m<10){
        printf("Yes");
        break;
      }
    }
  }
  if(i==10)
    printf("No");
}

Measured memory_bytes: 128
#include <stdio.h> 
int main() {
  int D = 0;
  int T = 0;
  int S = 0;
  scanf("%d%d%d",&D,&T,&S);
  if((double)D/S<=T){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 2120
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string s;

int main(){
	cin>>s;
	int n=s.size();
	vi a(26);
	for(int i=0;i<n;i++) a[s[i]-'a']++;
	char res='a';
	for(int i=0;i<26;i++){
		if(!a[i]){
			cout<<res<<endl;
			return 0;
		}
		res++;
	}
	cout<<"None"<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>


/*
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::'''```````:::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::''`_,-''.,...  `::::::::::::::::::
:::::::::::::::::::::::::::::::::::::' _,-',;;!!!!!!!!!; `::::::::::::::::
::::::::::::::'`````:::::::::::::'' .-' ;<!!!!!!!'''`_..' `:::::::::::::::
::::::::::'' ,;!!!;,`::::::::::' .-`.,,,zcccc,,cccd$$"",;> `::::::::::::::
:::::::::' ;!!!!!!!!; ``:::::' ;' ,c$$$$$$$$$$$CC<<"  ````_ ::::::::::::::
:::::::' ;!!!!!!!!!!!!!;   ' ;! z$$$$$$$$$$$$$$$$$$$$$$??". ::::::::::::::
::::::: <!!!!!!!!!!!!!' .  .!',c$$$$$$$$$$$$$c, `"""',;;<!! ::::::::::::::
:::::: ,!!!!!!!!!!!'`,;! .<! ,$$$$$$$$$$$$$$$$hc,,,..- !!!! `:::::::::::::
::::'  <!!!!!!!!!' .<!!!;!! ,$$$$$""???$$$"""?????"" .<!!!! ::::::::::::::
::: ;><!!!!!!!!! ,<!!!!!!!',c,  "??.< . "??h. -;;;;!!!!!!!' ::::::::::::::
::: !!!!!!!!!!' ;!!!!!!!!' d$$h.`$ccr,$h `;,."  `!!!!!!!!! :::::::::::::::
:::.`<!!!!!!!' !!!!!!!!!! dP"""?.`$$F`$$h.`!!!!!!!!!!!!!! .:::::::::::::::
::::. <!!!!!! !!!!!!!!!! ,$ .nn.' "$$ P"   <!!!!!!!!!!!' .::::::::::::::::
:::::. <!!!! ;!!!!!!!!!! $$ MMMMx  ?$  ,dx `!!!!!!!!!!' ::::::::::::::::::
```:::: `!!! !!!'!!!!!!  `$ MMMMMM, $r MMMr !!!!!!!!' .:::::::::::::::::::
`!!;,.`' ``' ``,;!!!!' ch." 4MMMMMM "$ 4MMM `!!!!!' ..::::::::::::::::::::
 !!!!!'````'``<!!!'`.z$$$$.  MMMMMMb $h MMM `!!'' .:::::::::::::::::::::::
 ..``.,d$$$$$c,,,. $$$$$F"?  "MMMMMM $$ 4P" '  .::::::::::::::::::::::::::
dM""..""?$$$$$$$$$$$$$$$$$$c  "MM"   $$>`   ,c  `:::::::::::::::::::::::::
MMn.`"?hc,d$$$$$$$$$$$$$$$$$$. `P    $P'   -??P== `:::::::::::::::::::::::
MMMMMnx`"?$$$$$$$$$$$P".,.`"??$ccccc$.z$$$$.  `' .:::::::::::::::::'    ''
MMMMMM,' .?$$$$$$$$$$ d$$$    d$$$$$$$$$$$$$h..``::::::::::::::::'
MMMMMMMn `?$$$$$$$$$$,.?$$h. =."?$$$$$$$$$$$$$$hc,.``'::::::::::'
MMMMMMMM ;, `"??$$$$$$h  ?$$h. -m,``""??$$$$$$$$$$$$$c,.``````'
MMMMMMM> !!! ?cc,.,d$$$$h.`"?$hc   `P  .`"?$$$$$$$$$$$$$$$$$$$          .:
MMMMMMM ,!!'. $$$$$$$$$??=== `"""=c, " P  n. "$$$$$$$$$$$$$$$$c_    ,.::::
MMMMMMP !!! Mr<$$$$"".,c,;M ;<!! ..""=_ ' 4 .br .`""??$$$$$$$$??"".:::::::
MMMMMM';!!',M>'$$$$$$$$$>4M `!!! 4MMbn.`"=cc," -'P",c=.,.`.. .=  :::::::::
MMMMM' !!! dMb $$$$$$$$P MM> !!! 4MMMMMMr :..`"-._""Pr4"'-P" .,.`:::::::::
MMMM' <!!!,MMM "$$$$$$P dMM>;!!! 4MMMMMMb :::::.. "-=cczyycc??" .:::::::::
MMMP <!!! dMMMb "?$$P" uMMM>;!!! 4MMMMMMMr`:::::::::.........:::::::::::::
MMP';!!! ;MMMMMMn,.".uMMMMM ;!!! MMMMMMMMM,`::::::::::::::::::::::::::::::
MM ;!!!! MMMMMMMMMMMMMMMMMM !!!! MMMMMMMMMb `:::::::::::::::::::::::::::::
M" !!!! uMMMMMMMMMMMMMMMMMP !!! ;MMMMMMMMMMx :::::::::::::::::::::::::::::
P.!!!! ,MMMMMMMMMMMMMMMMMM ,!!! MMMMMMMMMMMMx`::::::::::::::::::::::::::::
 !!!!> MMMMMMMMMMMMMMMMMMP !!!',MMMMMMMMMMMMM `:::::::::::::::::::::::::::
*/


int main() {
	int a, b;

	std::cin >> a >> b;

	std::cout << (a + b) % 24 << std::endl;
	
	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    h = list(map(int, input().split()))
    dp = [0] * n
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(2, n):
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]))
    print(dp[n - 1])


if __name__ == '__main__':
    main()


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

int main() {

  string s, t;
  cin >> s >> t;

  size_t n{s.size()};
  size_t m{t.size()};
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));

  for (size_t i{}; i < n; ++i) {
    for (size_t j{}; j < m; ++j) {
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;
      } else {
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
      }
    }
  }

  string ans;
  for (size_t i{n}, j{m}; i > 0 && j > 0;) {
    if (dp[i][j] == dp[i - 1][j]) {
      --i;
    } else if (dp[i][j] == dp[i][j - 1]) {
      --j;
    } else {
      ans = s[i - 1] + ans;
      --i, --j;
    }
  }

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


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  map<string, map<string, int> > mp;
  int n, f;
  cin >> n >> f;
  rep(i, 0, n) {
    int m;
    cin >> m;
    vector<string> v;
    rep(j, 0, m) {
      string s;
      cin >> s;
      v.pb(s);
    }
    sort(v.begin(), v.end());
    rep(j, 0, m) {
      rep(k, j + 1, m) {
        mp[v[j]][v[k]]++;
      }
    }
  }
  vector<pair<string, string> > ans;

  for(map<string, map<string, int> >::iterator itr = mp.begin(); itr != mp.end(); itr++) {
    for(map<string, int>::iterator sitr = itr->second.begin(); sitr != itr->second.end(); sitr++) {
      if(sitr->second >= f) {
        ans.pb(pair<string, string>(itr->first, sitr->first));
      }
    }
  }
  cout << ans.size() << endl;
  rep(i, 0, ans.size()) cout << ans[i].first << " " << ans[i].second << endl;
}

Measured memory_bytes: 3708
A = []
B = [[False for _ in range(3)] for __ in range(3) ]
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                B[i][j] = True

ansFlag = False

for i in range(3):
    ansi = True
    for j in range(3):
        if B[i][j] == False:
            ansi = False

    if ansi:
        ansFlag = True

for i in range(3):
    ansi = True
    for j in range(3):
        if B[j][i] == False:
            ansi = False

    if ansi:
        ansFlag = True

ansi = True
for j in range(3):
    if B[2-j][j] == False:
        ansi = False

if ansi:
    ansFlag = True

ansi = True
for j in range(3):
    if B[j][2-j] == False:
        ansi = False

if ansi:
    ansFlag = True

ansi = True
for j in range(3):
    if B[j][j] == False:
        ansi = False

if ansi:
    ansFlag = True

ansi = True
for j in range(3):
    if B[2-j][2-j] == False:
        ansi = False

if ansi:
    ansFlag = True

if ansFlag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
import bisect


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    l = sorted(input_list())
    ans = 0
    for a in range(n):
        for b in range(a+1, n):
            ans += bisect.bisect_left(l, l[a]+l[b]) - (b+1)
    print(ans)

def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


Measured memory_bytes: 74176
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	if( str.substr(0,4) == "YAKI" ){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
<?php
    
    $N = intval(trim(fgets(STDIN)));
    
    $X_array = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    $sum=INF;
    //位置$Zで総会を行うとする。
    for($X=1;$X<=100;$X++){
        $ans=0;
        for($i=0;$i<count($X_array);$i++){
            $ans = $ans + ($X_array[$i]-$X)**2;
        }
        
        if($sum>$ans){
            $sum=$ans;
        }
    }
    echo $sum."\n";
?>

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

long long gcd(long x, long y)
{    if (y == 0)
        return x;
    return gcd(y, x % y);}
long long lcm(long x, long y){ return x * y / gcd(x, y);}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}


int main()
{
    int N,D[100010]={},b;
    cin>>N;
    b=N/2;
    for(int i=0;i<N;i++){
        cin>>D[i];
    }

    sort(D,D+N);

    int ans=max(0,D[b]-D[b-1]);

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
X, K, D = list(map(int, input().split()))

if abs(X) > K*D:
    print(abs(X) - K*D)
else:
    X = abs(X)
    K -= X//D
    X = X%D
    if K%2 == 0:
        print(X)
    else:
        print(abs(X-D))

Measured memory_bytes: 61920
R, G, B, N = map(int, input().split())

res = 0
for i in range(N+1):
  count = R*i
  if N < count:
    break
  for j in range(N+1):
    count = R*i + G*j
    if N < count:
      break
    else:
      if (N - count) % B == 0:
        res += 1

print(res)

Measured memory_bytes: 40684
#include <stdio.h>                                                                                                                                         
                                                                                                                                                           
int main(void)                                                                                                                                             
{                                                                                                                                                          
        int n, k, i, now = 1;                                                                                                                              
                                                                                                                                                           
        scanf("%d", &n);                                                                                                                                   
        scanf("%d", &k);                                                                                                                                   
                                                                                                                                                           
        for (i = 0; i < n; i++) {                                                                                                                          
                if (now * 2 < now + k) {                                                                                                                   
                        now = now * 2;                                                                                                                     
                } else {                                                                                                                                   
                        now = now + k;                                                                                                                     
                }                                                                                                                                          
        }                                                                                                                                                  
        printf("%d\n", now);                                                                                                                               
        return 0;                                                                                                                                          
}

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

int n, s, a, v[100005];
int main()
{
	int i;
	cin >> n;
	for (i = 0; i <n; i++) {
		scanf ("%d", &a);
		if (a % 2 == n % 2) {
			cout << 0;
			return 0;
		}
		v[a]++;
		if (a == 0 && v[a] > 1 || a != 0 && v[a] > 2) {
			cout << 0;
			return 0;
		}
	}
	for (i = 0, s = 1; i <n / 2; i++) s = (s * 2) % 1000000007;
	cout << s;
    return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 16 09:49:30 2019

@author: Shunya
"""

inputbox = input()
box = inputbox.split()
A = int(box[0])
B = int(box[1])
ans = A - B*2
if ans < 0:
    ans = 0
print (ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;


int main() {
	string s;
	cin >> s;

	long long ans = 0;
	int i = s.size() - 1;

	int n_bc = 0;
	while (i >= 0) {
		if (s[i] == 'A') {
			ans += n_bc;
			i--;
		} else if (s[i] == 'B') {
			n_bc = 0;
			i--;
		} else {
			if (i > 0 && s[i - 1] == 'B') {
				// BC
				n_bc++;
				i -= 2;
			} else {
				n_bc = 0;
				i--;
			}
		}
	}


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


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define SORT(V) sort((V).begin(),(V).end())

int main(){
  long long K;
  scanf("%lld",&K);
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);

  long long a = A%K;
  long long b = (A-a)/K;
  if(A<=b*K && b*K <=B) {cout<<"OK"<<endl;}
  else if(A<=(b+1)*K && (b+1)*K <=B) {cout<<"OK"<<endl;}
  else{cout<<"NG"<<endl;}
  return 0;
}


Measured memory_bytes: 3660
k = { 'R', 'U', 'D' }
g = { 'L', 'U', 'D' }
s = input()
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] in k:
            continue
        else:
            print('No')
            exit()
    else:
        if s[i] in g:
            continue
        else:
            print('No')
            exit()
print('Yes')


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

using namespace std;

int main(){
    int n;
    while(cin >> n && n > 0) {
        int ans = 0;

        vector<int> p(n - 1);
        vector<int> c(n - 1);
        REP(i, n - 1) cin >> p[i];
        REP(i, n - 1) cin >> c[i];
        REP(i, n - 1) ans += c[i];

        vector<int> deg(n);
        REP(i, n - 1) {
            int a = i + 1, b = p[i] - 1;
            deg[a] ++;
            deg[b] ++;
        }

        vector<vector<pair<int, int>>> G(n);
        REP(i, n - 1) {
            int a = i + 1, b = p[i] - 1;
            if(deg[a] < 2) continue;
            if(deg[b] < 2) continue;
            G[a].push_back(make_pair(b, c[i]));
            G[b].push_back(make_pair(a, c[i]));
            ans += 2 * c[i];
        }

        int longest = 0;
        REP(s, n) {
            const int INF = 1 << 29;
            vector<int> dist(n, INF);
            dist[s] = 0;
            queue<int> que;
            que.push(s);
            while(!que.empty()){
                int u = que.front(); que.pop();
                for(auto pr : G[u]) {
                    int v = pr.first;
                    int nd = dist[u] + pr.second;
                    if(dist[v] > nd) {
                        dist[v] = nd;
                        que.push(v);
                    }
                }
            }
            REP(g, n) if(dist[g] < INF) longest = max(longest, dist[g]);
        }

        cout << ans - longest << endl;

    }
    return 0;
}

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

int solve(int n, vector<vector<int> >& sched) {
    vector<long long> f(31, 0);

    for (int j = 0; j < n; ++j) {
        for (int k = 0; k < sched[j].size(); ++k) {
            if (sched[j][k]) {
                f[sched[j][k]] |= (1LL << j);
            }
        }
    }

    for (int j = 1; j <= 30; ++j) {
        long long t = f[j];
        for (int k = j-1; k > 0; --k) {
            if (t & f[k]) {
                t |= f[k];
            }
        }

        if (t == (1LL << n) - 1) {
            return j;
        }
    }

    return -1;
}

int main() {
    int n;
    vector<vector<int>> sched;
    while (true) {
        cin >> n;
        if (n == 0) break;
        sched.resize(n);
        for (int j = 0; j < n; ++j) {
            int l;
            cin >> l; sched[j].resize(l);
            for (int k = 0; k < l; ++k) {
                cin >> sched[j][k];
            }
        }
        cout << solve(n, sched) << endl;
    }
    return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>

char stack[100];
int sp = 0;

void push(char c)
{
	stack[sp++] = c;
}

char pop(void)
{
	if (sp == 0){
		return ('X');
	}
	return (stack[--sp]);
}

int main(void)
{
	char in[101];
	int p;
	
	while (1){
		fgets(in, 110, stdin);
		if (in[0] == '.'){
			break;
		}
		sp = 0;
		p = 0;
		while (in[p] != '.'){
			if (in[p] == '(' || in[p] == '['){
				push(in[p]);
			}
			else if (in[p] == ')'){
				if (pop() != '('){
					printf("no\n");
					break;
				}
			}
			else if (in[p] == ']'){
				if (pop() != '['){
					printf("no\n");
					break;
				}
			}
			p++;
		}
		if (in[p] == '.'){
			if (sp == 0){
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 524
c = input()
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

num = l.index(c)
print(l[num+1])

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

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    rep(i, N) cin >> s.at(i);
    int M;
    cin >> M;
    vector<string> t(M);
    rep(i, M) cin >> t.at(i);

    set<string> uniqS;
    rep(i, N) {
        uniqS.insert(s.at(i));
    }

    int maxScore = 0;
    for (string target : uniqS) {
        int score = 0;
        rep(i, N) {
            if (target == s.at(i)) {
                score++;
            }
        }
        rep(i, M) {
            if (target == t.at(i)) {
                score--;
            }
        }
        maxScore = max(maxScore, score);
    }

    cout << maxScore << endl;

    return 0;
}


Measured memory_bytes: 3616
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
using namespace std;

void swap(int &a,int &b){
	int temp = a;
	a = b;
	b = temp;
}

void bubbleSort(int *a,int n,int &count){
	bool flag = true; // reverse neighber exists
	while(flag == true){
		flag = false;
		for(int j = n - 1; j > 0; j--){
			if( a[j] < a[j-1]){
				swap(a[j],a[j-1]);
				count++;
				flag = true;
			}
		}
	}
}

void printArray(int *a,int n){
	cout<<a[0];
	if( n > 1){
		for(int i = 1; i < n; i ++){
			cout <<" "<<a[i];
		}
	}
	cout<<endl;
}


int main()
{
	int n;
	cin >> n ;
	int *targetArray = new int[n];
	for(int i = 0 ; i < n; i++) cin >> targetArray[i];
	int count = 0;
	bubbleSort(targetArray,n,count);
	printArray(targetArray,n);
	cout<< count<<endl;
	delete[] targetArray;
	return 0;
}





Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int n;
long long ans,num;
string s[100010];
char c[20];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		cin>>s[i];
		for(int j=0;j<10;++j) c[j]=s[i][j];
		sort(c,c+10);
		for(int j=0;j<10;++j) s[i][j]=c[j];
	}
	sort(s+1,s+n+1);
//	for(int i=1;i<=n;++i) cout<<s[i]<<endl;
	for(int i=2;i<=n;++i) {
		if(s[i]==s[i-1])
			++num;
		else {
			ans+=num*(num+1)/2;
			num=0;
		}
	}
	ans+=num*(num+1)/2;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 7296
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define vint vector<int>

int gcd(int a, int b){return b ? gcd(b,a%b):a;}

int main(){
    int a,b;
    while(~scanf("%d%d",&a,&b)) {
        cout << gcd(a,b) << endl;
    }

    return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>

int main(){
  int v=0,j,i,N,k,A[1000];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++){
    printf("%d ",A[i]);

  }
  printf("%d",A[N-1]);
  printf("\n");
  //sort
  for(i=1;i<=N-1;i++){
    v = A[i];
    j = i - 1;
    while( j >= 0 & A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
    }
    for(k=0;k<N-1;k++){
      printf("%d ",A[k]);
    }
    printf("%d\n",A[N-1]);
  }

  return 0;
}

Measured memory_bytes: 2688