akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
    int N, A, B;
    int ans = 0;

    cin >> N >> A >> B;

    for (int i = 1; i <= N; i++) {
        int sum = 0;
        int num = i;
        while (num) {
            sum += num % 10;
            num /= 10;
        }

        if ( sum >= A && sum <= B) {
            ans += i;
        }
    }

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp> // Common file
    #include <ext/pb_ds/tree_policy.hpp>
    #include <functional> // for less

    using namespace std;
    #define md 1000000007
    #define itn int
    #define pb push_back
    #define mp make_pair
    // #define ull unsigned long long int
    #define ll long long 
    #define int ll
    #define ppi pair<int, int>
    #define ppl pair<ll, ll>
    #define vi vector<int>
    #define all(x) x.begin(), x.end()
    #define ff first
    #define lb lower_bound
    #define ub upper_bound
    #define ss second
    #define inf 1e9
    #define enld '\n'
    #define cuot cout
    #define trace1(x) cerr << #x << ": " << x << endl
    #define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
    #define trace3(x, y, z)                                                        \
      cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": "    \
           << z << endl
    #define trace4(a, b, c, d)                                                     \
      cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
           << c << " | " << #d << ": " << d << endl
    #define trace5(a, b, c, d, e)                                                  \
      cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
           << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
    #define trace6(a, b, c, d, e, f)                                               \
      cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
           << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | "   \
           << #f << ": " << f << endl
    #define trace(v)                                                               \
      for (auto it = v.begin(); it != v.end(); it++)                               \
        cerr << *it << " ";                                                        \
      cerr << endl;
    #define linf 1e18
    #define reset(x) memset(x, 0, sizeof(x))
    #define rep(i, a, b) for (int i = a; i < b; i++)

    using namespace __gnu_pbds;

    typedef tree<int, null_type, less<int>, rb_tree_tag,
                 tree_order_statistics_node_update>
        oset;

    void fastio() {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
    }
  
  
    void solve()
    {
        int n,w;cin>>n>>w;
        int wt[n],v[n];
        rep(i,0,n)cin>>wt[i]>>v[i];
        int val[200005];
        for(int i=0;i<200005;i++)val[i]=1e10;
        val[0]=0;
        for(int i=0;i<n;i++){
            for(int j=100000;j>=0;j--){
                val[j+v[i]]=min(val[j+v[i]],val[j]+wt[i]);
            }
        }
        for(int i=100000;i>=0;i--){
            if(val[i]<=w){
                cout<<i<<endl;return;
            }
        }   
    }

    signed main() {
      fastio();
      int t;
      t = 1;
      // cin >> t;
      for (int i = 1; i <= t; i++) {
        // cout << "Case #" << i << ": ";
        solve();
      }
      return 0;
    }

Measured memory_bytes: 1792
/**
 *    author:  skmonir
 *    created: 12-May-2018 18:10:14
**/

#include <bits/stdc++.h>

using namespace std;

#define endl                '\n'
#define TN                  typename
#define mod                 1000000007LL
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define mem(x, y)           memset(x, y, sizeof x)
#define FOR(x, l, r)        for (int x = l; x <= r; ++x)
#define ROF(x, l, r)        for (int x = l; x >= r; --x)

template <TN T> inline void Int(T &n) {
    n = 0; int f = 1; register int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> inline void umin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void umax(T &a, T b) {a = a > b ? a : b;}
template <TN T, TN W> inline void Int(T &x, W &y) {Int(x), Int(y);}
template <TN T, TN W, TN Q> inline void Int(T &x, W &y, Q &z) {Int(x, y), Int(z);}

const int N = 1e5 + 7;
const int inf = 1e9 + 7;


int solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d)) {
        printf("Yes\n");
    } else printf("No\n");

    return 0;
}

int main() {
    int tests = 1, CaseNo = 0; //Int(tests);
    while (tests--) {
        //printf("Case %d: ", ++CaseNo);
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;


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

	// long long?
	int N;
	string S;
	cin >> N >> S;

	vector<int> nE1(N, 0);
	vector<int> nW1(N, 0);
	if (S[0] == 'W') nW1[0] = 1;
	if (S[0] == 'E') nE1[0] = 1;

	for (int i = 0; i != N - 1; ++i) {
		nW1[i + 1] = (S[i + 1] == 'W') ? nW1[i] + 1 : nW1[i];
		nE1[i + 1] = (S[i + 1] == 'E') ? nE1[i] + 1 : nW1[i];
	}
	vector<int> nE2(N, 0);
	vector<int> nW2(N, 0);
	if (S[N-1] == 'W') nW2[0] = 1;
	if (S[N-1] == 'E') nE2[0] = 1;
	for (int i = 0; i != N - 1; ++i) {
		nW2[i + 1] = (S[N - i - 2] == 'W') ? nW2[i] + 1 : nW2[i];
		nE2[i + 1] = (S[N - i - 2] == 'E') ? nE2[i] + 1 : nE2[i];
	}

	int ans = inf;
	ans = min(ans, nE2[N - 2]);
	for (int i = 1; i != N - 1; ++i) {
		ans = min(ans, nW1[i - 1] + nE2[N - i - 2]);
	}
	ans = min(ans, nW1[N - 2]);

	cout << ans << endl;


	return 0;

}

Measured memory_bytes: 5396
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    int n, k;
    cin >> n >> k;
    vec<bool> snuke(n, false);

    forn(i, k) {
        int d;
        cin >> d;
        forn(j, d) {
            int a;
            cin >> a;
            snuke[a - 1] = true;
        }
    }

    cout << count(all(snuke), false) << endl;

    return 0;
}

Measured memory_bytes: 3660
/*

*/
#include <bits/stdc++.h>

using namespace std;

#define ll          long long int
#define mp          make_pair
#define pb          push_back
#define fi          first
#define si          second
#define fastIO      ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n)      for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n)     for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n)      for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n)     for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m)   for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m)  for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m)  for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 1e7;
const int mod = 1e9+7;
ll n;
double p[3000];
double dp[3000][3000];

double func(ll i, ll no_of_heads){
	//base case
	if(no_of_heads == 0){
		return 1;
	}
	if(i == n){
		return 0;
	}
	//recursive case
	if(dp[i][no_of_heads] > -1){ return dp[i][no_of_heads];}

	double tail_curr = (1-p[i])*func(i + 1, no_of_heads);
	double head_curr = p[i]*func(i + 1, no_of_heads-1);

	return dp[i][no_of_heads] = tail_curr + head_curr;

}

int main(){
fastIO
    memset(dp, -1.0, sizeof(dp));
	cin>>n;
	F(p, n);
	// no of heads should be between n to ceil((n+1)/2)
	cout<<fixed<<setprecision(10)<<func(0, (n+1)/2);
}

Measured memory_bytes: 74352
using System.Linq;
using System.Collections.Generic;
using System;
using System.Collections;

class A {
    
    static void Main() {
        int[] a = Console.ReadLine().Split(' ').Select(q => int.Parse(q)).ToArray();
        int N = a[0];
        int L = a[1];
        string[] s = new string[N];
        for(int i = 0; i < N; i++) {
            s[i] = Console.ReadLine();

        }
        Array.Sort(s);
        for(int i = 0; i < N; i++) {
            Console.Write(s[i]);
        }
        Console.WriteLine();
        }
    
}

Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
    int a, b; cin>>a>>b;
    if((a*b)%2==0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

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

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> grid(h);
  rep(i,h){
    cin >> grid[i];
  }
  int white_count = 0;
  rep(i,h){
    rep(j,w){
      if(grid[i][j] == '.') white_count++;
    }
  }
  vector<vector<int>> dist(h, vector<int>(w, INF));
  //vector<vector<int>> prev_x(h, vector<int>(w, -1));
  //vector<vector<int>> prev_y(h, vector<int>(w, -1));
  queue<P> que;
  dist[0][0] = 0;
  que.push({0, 0});
  while(!que.empty()){
    P p = que.front(); que.pop();
    int y = p.first, x = p.second;
    rep(i,4){
      int ny = y + dy[i], nx = x + dx[i];
      if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
      if(grid[ny][nx] == '#') continue;
      if(dist[ny][nx] != INF) continue;
      dist[ny][nx] = dist[y][x] + 1;
      //prev_y[ny][nx] = y;
      //prev_x[ny][nx] = x;
      que.push({ny, nx});
    }
  }
  if(dist[h-1][w-1] == INF){
    cout << -1 << endl;
    return 0;
  }
  cout << white_count - dist[h - 1][w - 1] -1 << endl;
  //経路復元
  //int y = h - 1;
  //int x = w - 1;
  //while(x != -1 && y != -1){
  //  grid[y][x] = 'a';
  //  int px = prev_x[y][x];
  //  int py = prev_y[y][x];
  //  x = px, y = py;
  //}
}

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

int main(){
        char s[11];
        cin >> s;

        int n;
        for(n=0; s[n]!=0; n++){}

        if(s[0]!='A'){
                cout << "WA" << endl;
                return 0;
        }

        int c=0;
        for(int i=2; i<n-1; i++)if(s[i]=='C') c++;
        if(c!=1){
                cout << "WA" << endl;
                return 0;
        }

        for(int i=0; i<n; i++){
                if(s[i]=='A' || s[i]=='C')continue;
                if('a'>s[i] || s[i]>'z'){
                        cout << "WA" << endl;
                        return 0;
                }
        }

        cout << "AC" << endl;
        return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int now = 1;
		for (int i = 0; i < N; i++) {
			now = Math.min(now * 2, now + K);
		}
		
		System.out.println(now);
	}
}


Measured memory_bytes: 21712
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int dx2[4] = { 0,-2,0,2 };
int dy2[4] = { -2,0,2,0 };
int m[15][15];
int main() {
	int x[10000],y[10000],z[10000];
	char s,t;
	int count=0,M=0;
	int n=0;
	while(true){
		cin>>x[n]>>s>>y[n]>>t>>z[n];
		if (cin.eof())break;
		n++;
	}
	n--;
	//cout<<n<<endl;
	for(int i=0;i<=n;i++){
		if(z[i]==1){
			m[y[i]][x[i]]++;
			for(int j=0;j<4;j++){
				if(value(y[i]+dy[j],x[i]+dx[j],10,10)){
					m[y[i]+dy[j]][x[i]+dx[j]]++;
				}
			}
		}
		else if(z[i]==2){
			for(int j=-1;j<=1;j++){
				for(int k=-1;k<=1;k++){
					if(value(y[i]+k,x[i]+j,10,10)){
						m[y[i]+k][x[i]+j]++;
					}
				}
			}
		}
		else{
			for(int j=-1;j<=1;j++){
				for(int k=-1;k<=1;k++){
					if(value(y[i]+k,x[i]+j,10,10)){
						m[y[i]+k][x[i]+j]++;
					}
				}
			}
			for(int j=0;j<4;j++){
				if(value(y[i]+dy2[j],x[i]+dx2[j],10,10)){
					m[y[i]+dy2[j]][x[i]+dx2[j]]++;
				}
			}
		}
		/*for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				cout<<m[i][j]<<" ";
			}
			cout<<endl;
		}*/
	}
	for(int i=0;i<=9;i++){
		for(int j=0;j<=9;j++){
			if(m[i][j]==0) count++;
			if(m[i][j]>M) M=m[i][j];
		}
	}
	cout<<count<<endl;
	cout<<M<<endl;
}

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

int main(){
 int a,b;
  cin>>a>>b;
  if(a==1 && b==2) cout<<3<<endl;
  else if(a==1 && b==3) cout<<2<<endl;
  else if(a==2 && b==1) cout<<3<<endl;
  else if(a==3 && b==1) cout<<2<<endl;
  else if(a==2 && b==3) cout<<1<<endl;
  else if(a==3 && b==2) cout<<1<<endl;
  return 0;
}

Measured memory_bytes: 256
s = input()

ans = 0

for i in range(len(s)):
  if not s[i] in 'ACGT':
    continue
  count = 1
  for j in range(i + 1, len(s)):
    if s[j] in 'ACGT':
      count += 1
    else:
      break
  ans = max(ans, count)

print(ans)

Measured memory_bytes: 3060
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] ar = new int[n];
        int res = 0;
        int cnt = 1;
        for (int i = 0; i < n; i++) {
            ar[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            res+=ar[i];
            if(res <= x){
                cnt++;
            }else{
                break;
            }
        }
        
        System.out.println(cnt);
    }
}

class io{
    public static void br(){
        System.out.println("");
    }

    public static void YesNo(boolean f) {
        System.out.println(f?"Yes":"No");
    }
    public static void YESNO(boolean f) {
        System.out.println(f?"YES":"NO");
    }

}

class Algo{
    public static boolean isOdd(int n){
        return n % 2 == 1;
    }
    public static boolean isEven(int n){
        return n % 2 == 0;
    }


}



Measured memory_bytes: 23764
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A = vector<int>(N + 1);
    vector<int> B = vector<int>(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    for (int i = N; i >= 1; i--) {
        int j = i;
        int sum = 0;
        while (j + i <= N) {
            j += i;
            sum ^= B[j];
        }
        B[i] = sum ^ A[i];
        // if (sum != A[i]) {
        //     cout << -1 << endl;
        //     return 0;
        // }
    }
    int s = accumulate(B.begin() + 1, B.end(), 0);
    cout << s << endl;
    for (int i = 1; i <= N; i++) {
        if (B[i] == 1) {
            cout << i << " ";
        }
    }
    if (s != 0) {
        putchar('\n');
    }
    return 0;
}

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

int dp[100005],h[100005];

int main(){


    int n;
    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>h[i];
    }


    dp[1] = 0;
    dp[2] = abs(h[2]-h[1]);

    for(int i=3;i<=n;i++){
        dp[i] = min( (dp[i-1]+abs(h[i]-h[i-1]) ) , (dp[i-2]+abs(h[i]-h[i-2]) ) );
    }

    cout<<dp[n]<<endl;



}


Measured memory_bytes: 1024
#include<stdio.h>
#define N 4

typedef struct{
  int P[N][N];
}Pazz;

Pazz Q;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int Heu(Pazz Q){
  int i ,j;
  int hx,hy,sum=0;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Q.P[i][j]==0)continue;

      hx=(Q.P[i][j]-1)%N-j;
      hy=(Q.P[i][j]-1)/N-i;

      if(hx<0)sum-=hx;
      else sum+=hx;

      if(hy<0)sum-=hy;
      else sum+=hy;
    }
  }
  return sum;
}
int dfs (int x,int y,int max,int count,int n){
  int i,temp;
  int x0,y0,ans=-1,h;

  h=Heu(Q);

  if(h==0)return count;
  if((count+h) > max)return -1;

  for(i=0;i<4;i++){
    x0=x+dx[i];
    y0=y+dy[i];

    if(((i == (n+2)%4 )&& (n!=-1))||!((0<=x0 )&&( x0<N) && (0<=y0) && (y0<N)))continue;
    temp=Q.P[y][x];
    Q.P[y][x]=Q.P[y0][x0];
    Q.P[y0][x0]=temp;

    ans= dfs(x0,y0,max,count+1,i);

    if(ans!=-1)return ans;
    temp=Q.P[y][x];
    Q.P[y][x]=Q.P[y0][x0];
    Q.P[y0][x0]=temp;
  }

  return -1;

}

int main(){
  int i,j;
  int kx,ky,ans,a;
  Pazz tP;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      scanf("%d",&a);
      Q.P[i][j]=a;
      if(a==0){
        kx=j;
        ky=i;
      }
    }
  }

  tP=Q;
  for(i=1;i<46;i++){
    Q=tP;
    ans=dfs(kx,ky,i,0,-1);
    if(ans!=-1){
      printf("%d\n",ans);
      break;
    }
  }

  return 0;
}



Measured memory_bytes: 2124
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)


int main() {
	string s;
	
	cin >> s;
	int len = (int)(s.size());
	long long int ans = 0,x = 0;
	rep(i,len){
		if(s[i] == 'W'){
			ans += x;
		}
		else if(s[i] == 'B'){
			x++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,Q;
  long long K;
  cin>>N>>K>>Q;
  vector<int>vec(Q);
  vector<long long>v(N,K-Q);
  for(int X=0;X<Q;X++){
    cin>>vec.at(X);
    v.at(vec.at(X)-1)++;
  }
  for(int X=0;X<N;X++){
    if(v.at(X)>0){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

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

int main()
{
    int n; cin>>n; n*=2;
    vector<int> a(n);
    for(e: a) cin>>e;
    sort(begin(a), end(a));

    int res=0;
    for(int i=0; i<n; i+=2)
        res+=a[i];
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
#define LP(i, a, b) for (int i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (int i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-13

#define INF 1e9
int const MaxSize = 100 + 10;

int reduce(string s, char tc) {

	bool allSame = true;
	LP(i, 0, s.length() - 1)
	{
		if (s[i] != s[i + 1]) {
			allSame = false;
			break;
		}
	}

	if (allSame)
		return 0;

	string next;

	bool same = true;
	LP(i, 0, s.length() - 1)
	{

		if (s[i] == tc) {
			next.push_back(s[i]);
		} else {
			same = false;
			next.push_back(s[i + 1]);
		}
	}

	//cout << next << endl;
	if (!same)
		return 1 + reduce(next, tc);
	else
		return 1;
}

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/george/A_1.in", "r", stdin);

	string s;

	cin >> s;

	int ans = 1000;

//	int steps = reduce(s, 'r');

//	cout << steps << endl;

	LP(i, 0, 26)
	{

		int steps = reduce(s, 'a' + i);

		if (steps >= 0) {
			//cout << (char)('a' + i) << " " << steps << endl;
			ans = min(ans, steps);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    string N;
    cin >> N;
    if(N[0] == '7' || N[1] == '7' || N[2] == '7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

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

char mcxi[4] = { 'm', 'c', 'x', 'i' };
int dig[4] = { 1000, 100, 10, 1 };

int mcxi2num(string s) {
	int n = 0;

	rep(i,4) {
		int c = s.find_first_of(mcxi[i]);
		if(c != string::npos) {
			if(c == 0) {
				n += dig[i];
			} else {
				n += s[c-1] <= '9' ? dig[i] * (int)(s[c-1] - '0') : dig[i]; 
			}
		}
	}

	return n;
}

int main() {
	int n, m, x, y;
	string a, b;

	cin >> n;
	rep(i,n) {
		cin >> a >> b;
		x = mcxi2num(a);
		y = mcxi2num(b);
		m = x + y;
		rep(j,4) {
			int d = m / dig[j];
			if(d >= 2) cout << d;
			if(d >= 1) cout << mcxi[j];
			m = m - d * dig[j];
		}
		cout << endl;
	}
}

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

int main()
{
	int N, M;
	scanf("%d %d", &N, &M);
	
	int i = 1, p[100] = {1}, m[100] = {}, tmp = M;
	while (1) {
		for (p[i] = p[i-1] + 1; p[i] * p[i] <= tmp; p[i]++) if (tmp % p[i] == 0) break;
		if (p[i] * p[i] > tmp) {
			p[i] = tmp;
			m[i] = 1;
			break;
		} else {
			for (m[i] = 0; tmp % p[i] == 0; m[i]++, tmp /= p[i]);
			i++;
		}
	}
	
	int j, k, cand[100] = {}, max = 1;
	while (1) {
		for (j = 1; j <= i; j++) if (cand[j] < m[j]) break;
		if (j > i) break;
		else {
			cand[j]++;
			for (j--; j >= 1; j--) cand[j] = 0;
		}
		tmp = 1;
		for (j = 1; j <= i; j++) {
			for (k = 0; k < cand[j]; k++) tmp *= p[j];
		}
		if (tmp > max && M / tmp >= N) max = tmp;
	}
	
	printf("%d\n", max);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
N,M = list(map(int,input().split()))

e_list = [[] for i in range(N)]
for i in range(M):
    a,b = list(map(int,input().split()))
    a,b = a-1,b-1
    e_list[a].append(b)
    e_list[b].append(a)

vi = 0 #時と場合によってここを変える
from collections import deque
Q = deque([vi])
checked_list = [False for i in range(N)]
checked_list[vi]=True
chain = []
while len(Q)>0:
    v = Q.pop()
    chain.append(v+1)
    checked_list[v]=True
    flag=True
    for v1 in e_list[v]:
        if not checked_list[v1]:
            flag=False
            Q.append(v1)
    if flag:
        break

Q = deque([vi])

chain1 = []
while len(Q)>0:
    v = Q.pop()
    chain1.append(v+1)
    checked_list[v]=True
    flag=True
    for v1 in e_list[v]:
        if not checked_list[v1]:
            flag=False
            Q.append(v1)
    if flag:
        break

chain1 = chain1[::-1]

ans = chain1[:-1]+chain
print(len(ans))
print(*ans)

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

int main(){
  int H,W,i,j;

  while(1){
    cin >> H >> W;
    if(H == 0 && W == 0) break;

    for(i = 0; i < H; i++){
      for(j = 0; j < W; j++){
        if((i + j) % 2 == 0) cout << '#';
        else                 cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

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

int main() {
  long long A, B, C;
  cin >> A >> B >> C;
  
  
  if (A < B) {
    long long tmp = A;
    A = B;
    B = tmp;
  }
  if (A < C) {
    long long tmp = A;
    A = C;
    C = tmp;
  }
  
  cout << A * 10 + B + C << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
cum_A = [0]
mod = (10 ** 9) + 7
for i in range(N):
    cum_A.append((cum_A[i] + A[i]))

ans = 0
for i, a in enumerate(A):
    #print(f"{a}*{cum_A[N] - cum_A[i + 1]}")
    ans += a * ((cum_A[N] - cum_A[i + 1]) % mod)
    ans %= mod
    #print(ans)
print(ans)




Measured memory_bytes: 105148
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>

using namespace std;

typedef long long ll;
typedef long double ld;

ll big = 1000000007ll;
float likeabutterfly;
string likeabee;
ll n,m,q,h,k,w;
ll T;

ll M[500][500] = {0};

ll DP[301][301] = {0};

vector<vector<ll> > C1(602 , vector<ll>());
vector<vector<ll> > C2(602 , vector<ll>());

ll dp(ll i, ll j){

if(i == n || j == n)return 0;

if(DP[i][j] != -1){return DP[i][j];}
ll fric = C2[i-j+n][n-i];

ll ans = fric + min(dp(i+1,j) , dp(i,j+1));
DP[i][j] = ans;

//cout << i << " " << j << "  : " << ans << "  " << fric << "\n";

return ans;
}

int main()
{
    ll c1,c2,c3,c4,c5,c6;
    ll a,b,d,e,g,c;
    ll x,y,z;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    cin >> n >> m;

    for(c1 = 0; c1 < n; c1++){
        string s;
        cin >> s;
        for(c2 = 0; c2 < m; c2++){
           M[c1][c2] = ll(s[c2])-97;

        }
    }

ll ans = 0;

    for(c2 = 0; c2 < m-1; c2++){


        for(c1 = 0; c1 < 301; c1++){
            for(c3 = 0; c3 < 301; c3++){
                DP[c1][c3] = -1;
            }
        }


        for(c1 = 0; c1 < 2*n; c1++){
            C1[c1].clear();
            C2[c1].clear();
        }

        for(c1 = -n; c1 < n; c1++){
            C2[n+c1].push_back(0);

            for(c3 = 0; c3 < n; c3++){
                c4 = c3+c1;
                C2[n+c1].push_back(C2[n+c1][c3]);
                if(c4 >= 0 && c4 < n){
                    if(M[c3][c2] == M[c4][c2+1]){
                        C2[n+c1][c3+1]++;
                    }
                }
               // if(c1 == 0){cout << c3 << " " << C2[n+c1][c3+1] << "\n";}
            }
        }


        k = c2;

        //cout << dp(0,0) << "\n";

        ans += dp(0,0);

    }




        cout << ans << "\n";

	return 0;
}


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

int main() {
	string s;
	cin >> s;
	bool valid = true;

	if(s[2] != s[3]) valid = false;
	if(s[4] != s[5]) valid = false;

	if(valid) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
/*
  AtCoder Beginner Contest 103
  B - String Rotation
*/

#include<iostream>
#include<string>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;

  int length = S.length();
  for (int offset = 0; offset < length; ++offset) {
    bool bCheck = true;
    for (int i = 0; i < length; ++i) {
      if (S[i] != T[(offset + i) % length]) {
        bCheck = false;
        break;
      }
    }

    if (bCheck == true) {
      printf("Yes\n");
      return 0;
    }
  }

  printf("No\n");
  return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> pairs;
    int a, b;
    rep(i, M) {
        cin >> a >> b;
        a--, b--;
        pairs.push_back(make_pair(a, b));
    }

    sort(pairs.begin(), pairs.end(), [&](const pair<int, int> x, const pair<int, int> y){return x.second < y.second; });

    int sum = 0;
    int endtime = 0;
    for (int i = 0; i < M; i++) {
        if (pairs.at(i).first >= endtime) {
            endtime = pairs.at(i).second;
            sum++;
        }
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>

long long int merge_sort(int N, int a[]){
  int pivot=N/2;
  long long int merge=0;
  int left=0,right=0;
  int b[pivot+1],c[N-pivot+1];
  if(N==1) return 0;
  for(int i=0;i<pivot;i++) b[i]=a[i];
  for(int i=0;i<N-pivot;i++) c[i]=a[i+pivot];
  merge+=merge_sort(pivot,b);
  merge+=merge_sort(N-pivot,c);
  b[pivot]=c[N-pivot-1]+1;
  c[N-pivot]=b[pivot-1];
  while(left<pivot || right<N-pivot)
    if(b[left]<=c[right]){
      a[left+right]=b[left];
      left++;
    } else {
      a[left+right]=c[right];
      right++;
      merge+=pivot-left;
    }
  return merge;
}

int main(){
  // input
  int N;
  int a[100000];
  // binary_search
  int left=1,right=1000000000,pivot;
  // element_number
  int b[100000];
  int S[100001];
  long long int inverse;
  
  // input
  scanf("%d",&N);
  for(int i=0;i<N;i++)
    scanf("%d",&a[i]);

  // binary_search
   while(right-left){
    pivot=(left+right+1)/2;
    // element_number
    for(int i=0;i<N;i++) b[i]=(a[i]>=pivot)*2-1;
    S[0]=0; for(int i=0;i<N;i++) S[i+1]=S[i]+b[i];
    //  for(int i=0;i<=N;i++) printf(" %d",S[i]); printf("\n");
    inverse = (long long int)N*(N+1)/2-merge_sort(N+1,S);
    //    printf("[%10d %10d] pivot %10d inverse %10d\n",left,right,pivot,inverse);
    if(inverse >= ((long long int)N*(N+1)/2+1)/2)
      left =pivot;
    else
      right=pivot-1;
  }
    
  printf("%d\n",left);
  
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<int,int> p;
//const ll big=998244353;
const ll big=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    ll n,k;cin >> n >> k;
    vector<ll> ar(100005);
    rep(i,n){
        int a,b;cin >> a >> b;
        ar[a]+=b;
    }
    ll sum=0;
    rep(i,100005){
        sum+=ar[i];
        if(sum>=k){
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 3984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			List<String> ret = new LinkedList<String>();
			int m, f, r;
			do {
				String[] inputList = br.readLine().split(" ");
				m = Integer.parseInt(inputList[0]);
				f = Integer.parseInt(inputList[1]);
				r = Integer.parseInt(inputList[2]);
				if (m == -1 && f == -1 && r == -1) {
					break;
				} else if ((m == -1 || f == -1) || m + f < 30) {
					ret.add("F");
				} else if (m + f < 50 && r < 50) {
					ret.add("D");
				} else if ((m + f < 50 && r >= 50) || m + f < 65) {
					ret.add("C");
				} else if (m + f < 80) {
					ret.add("B");
				} else {
					ret.add("A");
				}
			} while (true);
			for (String text : ret) {
				System.out.println(text);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16876
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            List<Tuple<string,int>> tpList = new List<Tuple<string, int>>();
            for (int i = 0; i < N; i++)
            {
                var r = Console.ReadLine().Split().ToArray();
                tpList.Add(new Tuple<string, int>(r[0], int.Parse(r[1])));
            }
            var target = Console.ReadLine();
            var flg = false;
            var ret = 0;
            for (int i = 0; i < N; i++)
            {
                if (!flg && tpList[i].Item1 == target)
                {
                    flg = true;
                    continue;
                }
                else if(flg)
                {
                    ret += tpList[i].Item2;
                }
                else
                {
                    continue;
                }
            }
            Console.WriteLine(ret);

        }
        
    }
}

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

int main()
{
	string s;
	cin >> s;
	map<char, int> M;
	for (auto a : s)
	{
		++M[a];
	}
	for (auto a : s)
	{
		if (M[a] % 2)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int H, W;
    cin >> H >> W;
    vector< vector<char> > a;
    for(int i=0; i<H; i++) {
        bool isContainBlack = false;
        vector<char> tmp(W);
        for(int j=0; j<W; j++) {
            cin >> tmp[j];
            if(tmp[j] == '#') {
                isContainBlack = true;
            }
        }
        if(isContainBlack == true) {
            a.push_back(tmp);
        }
    }

    vector<int> ok(W);
    for(int j=0; j<W; j++) {
        for(int i=0; i<a.size(); i++) {
            if(a[i][j] == '#') {
                ok.at(j) = 1;
            }
        }
    }

    for(int i=0; i<a.size(); i++) {
        for(int j=0; j<W; j++) {
            if(ok.at(j)) {
                cout << a[i][j];
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
(let* ((h (read))
    (w (read))
    (k (read))
    (c (make-array (list h w)))
    (ans 0))

    (dotimes (i h)
        (let ((a (read-line)))
            (dotimes (j w)
                (setf (aref c i j) (char a j))
            )
        )
    )

    (loop for maskR below (expt 2 h) do
        (loop for maskC below (expt 2 w) do
            (let ((block_num 0))
                (loop for i below h do
                    (loop for j below w do
                        (if (and (= (logand (ash maskR (- i)) 1) 0) (= (logand (ash maskC (- j)) 1) 0) (string= (aref c i j) "#"))
                            (incf block_num)
                        )
                    )
                )
                (if (= block_num k) (incf ans))
            )
        )
    )
    (princ ans)
)

Measured memory_bytes: 25612
#include <iostream>
#include <cstdio>
#include <vector>
#define ll long long
using namespace std;
int main(){
	ll n, x, y;
	cin >> n >> x >> y;
	std::vector<ll> v(n);
	for(ll i = 1; i<= n; i++){
		for(ll j = i + 1; j <= n; j++){
			ll d = min(j - i, abs(i - x)  + 1 + abs(y - j));
			v[d]++;
		}
	}
	for(ll i = 1; i < n; i++)
		printf("%lld\n", v[i]);
	return 0;
}

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

using namespace std;

int K, N, V, sz[20], x[200009], maxPref[200009], pf[400009], sf[400009], lft[19][200009], rgt[19][200009];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &V);
for (int i=1; i<=N; i++)
    scanf ("%d", &x[i]);
for (int i=0; (1 << i) <= V; i++)
    sz[i] = V >> i, K = i;
sz[++K] = 0;
for (int i=0; i<=K; i++)
{
    lft[i][1] = 1, lft[i][0] = 0;
    for (int j=2; j<=N; j++)
        if (x[j] - x[j - 1] <= sz[i]) lft[i][j] = lft[i][j - 1];
        else lft[i][j] = j;
    rgt[i][N] = N, rgt[i][N + 1] = N + 1;
    for (int j=N - 1; j>=1; j--)
        if (x[j + 1] - x[j] <= sz[i]) rgt[i][j] = rgt[i][j + 1];
        else rgt[i][j] = j;
}
int lim = 1 << K;
for (int i=0; i < lim; i++)
    sf[i] = N + 1;
for (int msk = 0; msk < lim; msk ++)
    for (int i=0; i<K; i++)
        if ((msk & (1 << i)) == 0)
            pf[msk | (1 << i)] = max (pf[msk | (1 << i)], (pf[msk] <= N ? rgt[i + 1][pf[msk] + 1] : N + 1)),
            sf[msk | (1 << i)] = min (sf[msk | (1 << i)], (sf[msk] >= 1 ? lft[i + 1][sf[msk] - 1] : 0));
for (int i=0; i<=N + 1; i++)
    maxPref[i] = -N;
for (int i=0; i<lim; i++)
    maxPref[sf[i]] = max (maxPref[sf[i]], pf[(lim - 1) ^ i]);
for (int i=1; i<=N + 1; i++)
    maxPref[i] = max (maxPref[i - 1], maxPref[i]);
for (int i=1; i<=N; i++)
    if (maxPref[rgt[0][i] + 1] >= lft[0][i] - 1) printf ("Possible\n");
    else printf ("Impossible\n");
return 0;
}


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

typedef long long LL;
const int MAX_N = 1e5 + 6;

LL p[MAX_N];

int main () {
	int n,a,b;
	while (scanf("%d %d %d",&n,&a,&b) != EOF) {
		for (int i=1;n>=i;i++) {
			scanf("%lld",&p[i]);
		}
		LL ans=0;
		for (int i=1;n>i;i++) {
			ans += min(LL(b),(p[i+1]-p[i])*a);
		}
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
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;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vector<int> l;
    rep(i,n){
        int t; cin>>t;
        l.push_back(t);
    }
    sort(l.begin(), l.end());
    int sum=0;
    rep(i, n){
        sum+=l[i];
    }
    sum-=l[n-1];
    string ans = (sum>l[n-1]) ? "Yes":"No";
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>

int main()
{
	double a,b,c;
	double PI = acos(-1.0);
	double S,L,H;
	scanf("%lf %lf %lf",&a,&b,&c);
    S=a*b*sin(c/180*PI)/2;
	L=sqrt(a*a+b*b-2*a*b*cos(c/180*PI))+a+b;
	H=2*S/a;
	printf("%.6lf\n%.6lf\n%.6lf\n",S,L,H);
	return 0;
}

Measured memory_bytes: 1080
import           Data.List
import           Data.List.Split
import           Data.Time.Clock.POSIX (getPOSIXTime)
import           Debug.Trace

calcNoCancelLength :: [Int] -> Int
calcNoCancelLength pointList =
    if null b then
        0
    else
        abs((head pointList) - head b) + calcNoCancelLength b
    where
        b = tail pointList

getResult :: Int -> [Int] -> String
getResult noCancelLength list
    | (null (tail list)) || (null (tail (tail list))) =
        []
    | otherwise =
        '\n' : (show (noCancelLength - abs(a - b) - abs(b - c) + abs(a - c))) ++
        (getResult noCancelLength tail1)
        where
            a = head list
            b = head tail1
            c = head tail2
            tail1 = tail list
            tail2 = tail tail1

main = do
    _ <- readLn :: IO Int
    line2 <- getLine
    -- rawPointList = [A1, A2, ..., AN]
    rawPointList <- return $ map (\el -> read el :: Int) (splitOn " " line2)
    pointList <- return (0 : rawPointList ++ [0])
    putStrLn $ tail $ getResult (calcNoCancelLength pointList) pointList


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

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

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, m; cin >> n >> m;
  int a[m], b[m]; rep(i, m) cin >> a[i] >> b[i];
  int num[n];
  rep(i, n) num[i] = i+1;
  
  int ans = 0;
  do {
    if(num[0] != 1) continue;
    
    int cnt = 0;
    rep(i, n-1) {
      rep(j, m) {
	if(((num[i] == a[j]) && (num[i+1] == b[j])) || ((num[i] == b[j]) && num[i+1] == a[j])) {
	  ++cnt;
	  break;
	}
      }
    }
    ans += (cnt==(n-1));
  } while(next_permutation(num, num+n));
  cout << ans;
}
      


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

int main(){
    int N;
    cin >> N;
    for(int i = 0; i <= 9; i++)
    {
        if (N > 111*i && N <= 111*(i+1)) {
            cout << 111*(i+1) << endl;
            return 0;
        }
    }
}

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

int main(void) {
	int limit = 1200;
	char *p, *s;
	s = (char *)malloc(sizeof(char) * limit);
	/* scanf("%s", s); */
	fgets(s, limit, stdin);
	for (p = s; *p; p++) {
		if ('a' <= *p && *p <= 'z') {
			printf("%c", toupper(*p));
		} else if ('A' <= *p && *p <= 'Z') {
			printf("%c", tolower(*p));
		} else {
			printf("%c", *p);
		}
	}
	free(s);
	return 0;
}



Measured memory_bytes: 2064
n, m, k = gets.split.map(&:to_i)

t = 0
for i in 0..n
  t = i * m
  # puts "$t : #{t}"
  for _ in 0...m
    # puts "j #{j}"
    t += n - 2 * i
    # puts t
    if t == k
      puts "Yes"
      exit
    end
  end
end
puts  "No"


Measured memory_bytes: 1788
import Foundation

let k = Int(readLine()!)!
let limit = 1000000
var mod = 7 % k
var exist = false
if (mod == 0) {
  print(1)
  exist = true
} else  {
  for i in (1..<limit) {
  	mod = ((mod % k) * (10 % k) + (7 % k)) % k
    if mod == 0 {
      print(i + 1)
      exist = true
      break
    }
  }
}

if !exist {
  print(-1)
}

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

int main()
{
    vector<int> s;
    vector<int> t;
    int n, q, temp, num = 0;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> temp;
        s.push_back(temp);
    }
    cin >> q;
    for (int i = 0; i < q; i++){
        cin >> temp;
        t.push_back(temp);
    }
    for (int i = 0; i < q; i++){
        if (*lower_bound(s.begin(), s.end(), t[i]) == t[i])
            num++;
    }
    cout << num << endl;
}



Measured memory_bytes: 3648
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  string mae = s.substr(0, 2), ushiro = s.substr(2, 2);
  bool yy = false, mm = false;
  if ("01" <= mae && mae <= "12") yy = true;
  if ("01" <= ushiro && ushiro <= "12") mm = true;
  if (yy && mm) cout << "AMBIGUOUS\n";
  else if (yy) cout << "MMYY\n";
  else if (mm) cout << "YYMM\n";
  else cout << "NA\n";
  return 0;
}


Measured memory_bytes: 256
length = gets.to_i

ary = gets.split(' ').map(&:to_i)

count = 0

ary.each_with_index do |_, idx|
  next if idx == 0 || idx == (length - 1)

  count += 1 if (ary[idx] > ary[idx - 1] && ary[idx] < ary[idx + 1]) || (ary[idx] < ary[idx - 1] && ary[idx] > ary[idx + 1])
end

puts count

Measured memory_bytes: 1788
from math import log2
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def ceil(n):
    return int(-n//1)*(-1)


N = int(input())

ans = ceil(log2(N))
if 2**ans > N:
    ans -= 1
print(2**ans)


Measured memory_bytes: 3060
N = int(input())
a = list(map(int, input().split()))

aa = [ai - i-1 for i,ai in enumerate(a)]

def tri_search(f:"f(x:float)->float", left, right, iter=100)->float:
    for _ in range(iter):
        ml = (left*2 + right) / 3
        mr = (left + right*2) / 3
        if f(ml) < f(mr):
            right = mr
        else:
            left = ml
    # print(left, right)
    return (right + left) / 2

def f(x):
    ret = 0
    x = int(x+0.5)
    for aai in aa:
        ret += abs(aai - x)
    return ret

b = tri_search(f, -10**9, 10**9)
print(min(f(b), f(b+1), f(b-1)))


Measured memory_bytes: 97744
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

//read question carefully!

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int val = 7 % n;
        for (int i = 1; i < 1e7; ++i)
        {
            if (val == 0)
            {
                cout << i << "\n";
                return 0;
            }
            val = ((10 * val) + 7) % n;
        }
        cout << -1 << "\n";
        return 0;
    }
}

Measured memory_bytes: 3612
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

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

	int mini=INT_MAX;
	rp(i,s.size()-2){
		string t=s.substr(i,3);
		int a = stoi(t);
		// ote(t);
		// ote(a);
		int diff = abs(753-a);
		if(mini>diff){
			mini=diff;
		}
	}

	ote(mini);
}


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

int main() {
  string S;
  cin >> S;
  bool ans;
  ans = true;
  int N;
  N = S.size();
  for (int i = 0; i < N; i += 2) {
    if (S.at(i) == 'L') {
      ans = false;
    }
  }
  for (int i = 1; i < N; i += 2) {
    if (S.at(i) == 'R') {
      ans = false;
    }
  }
  if (ans == true) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256